about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-15 13:43:53 +0000
committerbors <bors@rust-lang.org>2024-06-15 13:43:53 +0000
commit73c1bfbc5734af7e086fca13ed406889d643de52 (patch)
tree90b887f59f87d79345d665b891a799e613ecb707
parent3e5a02b13b1244545454752c6629b767522a44b1 (diff)
parent7c86db4ea5f051e0b355e37959264bd9998a17a9 (diff)
downloadrust-73c1bfbc5734af7e086fca13ed406889d643de52.tar.gz
rust-73c1bfbc5734af7e086fca13ed406889d643de52.zip
Auto merge of #12880 - bitfield:fix_doc_nits_b, r=Alexendoo
Fix doc nits

Clippy is wonderful, and reading its lints is a great way to learn about Rust. While doing this, I noticed a few little copyedits, such as adding trailing periods to sentences, or tweaking wording very slightly to improve its readability. I hope you will accept these suggestions as an act of love for the project, with my thanks for all the maintainers' hard work.

changelog: Docs [ mut_range_bound ]: fix doc nits
changelog: Docs [ needless_for_each ]: fix doc nits
changelog: Docs [ arc_with_non_send_sync ]: fix doc nits
changelog: Docs [ allow_attributes ]: fix doc nits
changelog: Docs [ allow_attributes_without_reason ]: fix doc nits
-rw-r--r--clippy_lints/src/allow_attributes.rs13
-rw-r--r--clippy_lints/src/arc_with_non_send_sync.rs2
-rw-r--r--clippy_lints/src/attrs/mod.rs11
-rw-r--r--clippy_lints/src/loops/mod.rs6
-rw-r--r--clippy_lints/src/needless_for_each.rs6
5 files changed, 19 insertions, 19 deletions
diff --git a/clippy_lints/src/allow_attributes.rs b/clippy_lints/src/allow_attributes.rs
index 123d0e51eee..990f724ab9d 100644
--- a/clippy_lints/src/allow_attributes.rs
+++ b/clippy_lints/src/allow_attributes.rs
@@ -10,20 +10,19 @@ use rustc_session::declare_lint_pass;
 declare_clippy_lint! {
     /// ### What it does
     /// Checks for usage of the `#[allow]` attribute and suggests replacing it with
-    /// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
+    /// `#[expect]`. (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
     ///
-    /// The expect attribute is still unstable and requires the `lint_reasons`
+    /// The expect attribute is still unstable and requires the `lint_reasons` feature
     /// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
     /// the crate root.
     ///
-    /// This lint only warns outer attributes (`#[allow]`), as inner attributes
+    /// This lint only warns on outer attributes (`#[allow]`), as inner attributes
     /// (`#![allow]`) are usually used to enable or disable lints on a global scale.
     ///
     /// ### Why restrict this?
-    /// `#[allow]` attributes can linger after their reason for existence is gone.
-    /// `#[expect]` attributes suppress the lint emission, but emit a warning if
-    /// the expectation is unfulfilled. This can be useful to be notified when the
-    /// lint is no longer triggered, which may indicate the attribute can be removed.
+    /// The `#[allow]` attribute does not warn when the expected lint is no longer triggered,
+    /// whereas `#[expect]` calls attention to this fact. This can be a useful reminder to
+    /// remove attributes that are no longer needed.
     ///
     /// ### Example
     /// ```rust,ignore
diff --git a/clippy_lints/src/arc_with_non_send_sync.rs b/clippy_lints/src/arc_with_non_send_sync.rs
index 38933897389..d57ab539fff 100644
--- a/clippy_lints/src/arc_with_non_send_sync.rs
+++ b/clippy_lints/src/arc_with_non_send_sync.rs
@@ -17,7 +17,7 @@ declare_clippy_lint! {
     /// `Arc<T>` is a thread-safe `Rc<T>` and guarantees that updates to the reference counter
     /// use atomic operations. To send an `Arc<T>` across thread boundaries and
     /// share ownership between multiple threads, `T` must be [both `Send` and `Sync`](https://doc.rust-lang.org/std/sync/struct.Arc.html#thread-safety),
-    /// so either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`
+    /// so either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`.
     ///
     /// ### Example
     /// ```no_run
diff --git a/clippy_lints/src/attrs/mod.rs b/clippy_lints/src/attrs/mod.rs
index e4c98a32fd6..7c27c0b28f5 100644
--- a/clippy_lints/src/attrs/mod.rs
+++ b/clippy_lints/src/attrs/mod.rs
@@ -270,13 +270,14 @@ declare_clippy_lint! {
 
 declare_clippy_lint! {
     /// ### What it does
-    /// Checks for attributes that allow lints without a reason.
-    ///
-    /// (This requires the `lint_reasons` feature)
+    /// Checks for attributes that allow lints without specifying the reason
+    /// they should be allowed. (This requires the `lint_reasons` feature.)
     ///
     /// ### Why restrict this?
-    /// Justifying each `allow` helps readers understand the reasoning,
-    /// and may allow removing `allow` attributes if their purpose is obsolete.
+    /// There should always be a specific reason to allow a lint. This reason
+    /// should be documented using the `reason` parameter, so that readers can
+    /// understand why the `allow` is required, or remove it if it's no
+    /// longer needed.
     ///
     /// ### Example
     /// ```no_run
diff --git a/clippy_lints/src/loops/mod.rs b/clippy_lints/src/loops/mod.rs
index 08682942153..64ea591993d 100644
--- a/clippy_lints/src/loops/mod.rs
+++ b/clippy_lints/src/loops/mod.rs
@@ -356,10 +356,10 @@ declare_clippy_lint! {
 
 declare_clippy_lint! {
     /// ### What it does
-    /// Checks for loops which have a range bound that is a mutable variable
+    /// Checks for loops with a range bound that is a mutable variable.
     ///
     /// ### Why is this bad?
-    /// One might think that modifying the mutable variable changes the loop bounds
+    /// One might think that modifying the mutable variable changes the loop bounds. It doesn't.
     ///
     /// ### Known problems
     /// False positive when mutation is followed by a `break`, but the `break` is not immediately
@@ -381,7 +381,7 @@ declare_clippy_lint! {
     /// let mut foo = 42;
     /// for i in 0..foo {
     ///     foo -= 1;
-    ///     println!("{}", i); // prints numbers from 0 to 42, not 0 to 21
+    ///     println!("{i}"); // prints numbers from 0 to 41, not 0 to 21
     /// }
     /// ```
     #[clippy::version = "pre 1.29.0"]
diff --git a/clippy_lints/src/needless_for_each.rs b/clippy_lints/src/needless_for_each.rs
index 630018238f4..143acc2b1cb 100644
--- a/clippy_lints/src/needless_for_each.rs
+++ b/clippy_lints/src/needless_for_each.rs
@@ -25,14 +25,14 @@ declare_clippy_lint! {
     /// ```no_run
     /// let v = vec![0, 1, 2];
     /// v.iter().for_each(|elem| {
-    ///     println!("{}", elem);
+    ///     println!("{elem}");
     /// })
     /// ```
     /// Use instead:
     /// ```no_run
     /// let v = vec![0, 1, 2];
-    /// for elem in v.iter() {
-    ///     println!("{}", elem);
+    /// for elem in &v {
+    ///     println!("{elem}");
     /// }
     /// ```
     ///