Skip to content

Commit 73c1bfb

Browse files
committed
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
2 parents 3e5a02b + 7c86db4 commit 73c1bfb

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

clippy_lints/src/allow_attributes.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ use rustc_session::declare_lint_pass;
1010
declare_clippy_lint! {
1111
/// ### What it does
1212
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
13-
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
13+
/// `#[expect]`. (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
1414
///
15-
/// The expect attribute is still unstable and requires the `lint_reasons`
15+
/// The expect attribute is still unstable and requires the `lint_reasons` feature
1616
/// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
1717
/// the crate root.
1818
///
19-
/// This lint only warns outer attributes (`#[allow]`), as inner attributes
19+
/// This lint only warns on outer attributes (`#[allow]`), as inner attributes
2020
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
2121
///
2222
/// ### Why restrict this?
23-
/// `#[allow]` attributes can linger after their reason for existence is gone.
24-
/// `#[expect]` attributes suppress the lint emission, but emit a warning if
25-
/// the expectation is unfulfilled. This can be useful to be notified when the
26-
/// lint is no longer triggered, which may indicate the attribute can be removed.
23+
/// The `#[allow]` attribute does not warn when the expected lint is no longer triggered,
24+
/// whereas `#[expect]` calls attention to this fact. This can be a useful reminder to
25+
/// remove attributes that are no longer needed.
2726
///
2827
/// ### Example
2928
/// ```rust,ignore

clippy_lints/src/arc_with_non_send_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ declare_clippy_lint! {
1717
/// `Arc<T>` is a thread-safe `Rc<T>` and guarantees that updates to the reference counter
1818
/// use atomic operations. To send an `Arc<T>` across thread boundaries and
1919
/// share ownership between multiple threads, `T` must be [both `Send` and `Sync`](https://doc.rust-lang.org/std/sync/struct.Arc.html#thread-safety),
20-
/// so either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`
20+
/// so either `T` should be made `Send + Sync` or an `Rc` should be used instead of an `Arc`.
2121
///
2222
/// ### Example
2323
/// ```no_run

clippy_lints/src/attrs/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@ declare_clippy_lint! {
270270

271271
declare_clippy_lint! {
272272
/// ### What it does
273-
/// Checks for attributes that allow lints without a reason.
274-
///
275-
/// (This requires the `lint_reasons` feature)
273+
/// Checks for attributes that allow lints without specifying the reason
274+
/// they should be allowed. (This requires the `lint_reasons` feature.)
276275
///
277276
/// ### Why restrict this?
278-
/// Justifying each `allow` helps readers understand the reasoning,
279-
/// and may allow removing `allow` attributes if their purpose is obsolete.
277+
/// There should always be a specific reason to allow a lint. This reason
278+
/// should be documented using the `reason` parameter, so that readers can
279+
/// understand why the `allow` is required, or remove it if it's no
280+
/// longer needed.
280281
///
281282
/// ### Example
282283
/// ```no_run

clippy_lints/src/loops/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,10 @@ declare_clippy_lint! {
356356

357357
declare_clippy_lint! {
358358
/// ### What it does
359-
/// Checks for loops which have a range bound that is a mutable variable
359+
/// Checks for loops with a range bound that is a mutable variable.
360360
///
361361
/// ### Why is this bad?
362-
/// One might think that modifying the mutable variable changes the loop bounds
362+
/// One might think that modifying the mutable variable changes the loop bounds. It doesn't.
363363
///
364364
/// ### Known problems
365365
/// False positive when mutation is followed by a `break`, but the `break` is not immediately
@@ -381,7 +381,7 @@ declare_clippy_lint! {
381381
/// let mut foo = 42;
382382
/// for i in 0..foo {
383383
/// foo -= 1;
384-
/// println!("{}", i); // prints numbers from 0 to 42, not 0 to 21
384+
/// println!("{i}"); // prints numbers from 0 to 41, not 0 to 21
385385
/// }
386386
/// ```
387387
#[clippy::version = "pre 1.29.0"]

clippy_lints/src/needless_for_each.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ declare_clippy_lint! {
2525
/// ```no_run
2626
/// let v = vec![0, 1, 2];
2727
/// v.iter().for_each(|elem| {
28-
/// println!("{}", elem);
28+
/// println!("{elem}");
2929
/// })
3030
/// ```
3131
/// Use instead:
3232
/// ```no_run
3333
/// let v = vec![0, 1, 2];
34-
/// for elem in v.iter() {
35-
/// println!("{}", elem);
34+
/// for elem in &v {
35+
/// println!("{elem}");
3636
/// }
3737
/// ```
3838
///

0 commit comments

Comments
 (0)