This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +19
-19
lines changed Expand file tree Collapse file tree 5 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -10,20 +10,19 @@ use rustc_session::declare_lint_pass;
10
10
declare_clippy_lint ! {
11
11
/// ### What it does
12
12
/// 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))
14
14
///
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
16
16
/// on nightly. It can be enabled by adding `#![feature(lint_reasons)]` to
17
17
/// the crate root.
18
18
///
19
- /// This lint only warns outer attributes (`#[allow]`), as inner attributes
19
+ /// This lint only warns on outer attributes (`#[allow]`), as inner attributes
20
20
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
21
21
///
22
22
/// ### 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.
27
26
///
28
27
/// ### Example
29
28
/// ```rust,ignore
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ declare_clippy_lint! {
17
17
/// `Arc<T>` is a thread-safe `Rc<T>` and guarantees that updates to the reference counter
18
18
/// use atomic operations. To send an `Arc<T>` across thread boundaries and
19
19
/// 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`.
21
21
///
22
22
/// ### Example
23
23
/// ```no_run
Original file line number Diff line number Diff line change @@ -270,13 +270,14 @@ declare_clippy_lint! {
270
270
271
271
declare_clippy_lint ! {
272
272
/// ### 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.)
276
275
///
277
276
/// ### 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.
280
281
///
281
282
/// ### Example
282
283
/// ```no_run
Original file line number Diff line number Diff line change @@ -356,10 +356,10 @@ declare_clippy_lint! {
356
356
357
357
declare_clippy_lint ! {
358
358
/// ### 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.
360
360
///
361
361
/// ### 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.
363
363
///
364
364
/// ### Known problems
365
365
/// False positive when mutation is followed by a `break`, but the `break` is not immediately
@@ -381,7 +381,7 @@ declare_clippy_lint! {
381
381
/// let mut foo = 42;
382
382
/// for i in 0..foo {
383
383
/// 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
385
385
/// }
386
386
/// ```
387
387
#[ clippy:: version = "pre 1.29.0" ]
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ declare_clippy_lint! {
25
25
/// ```no_run
26
26
/// let v = vec![0, 1, 2];
27
27
/// v.iter().for_each(|elem| {
28
- /// println!("{}", elem );
28
+ /// println!("{elem}" );
29
29
/// })
30
30
/// ```
31
31
/// Use instead:
32
32
/// ```no_run
33
33
/// let v = vec![0, 1, 2];
34
- /// for elem in v.iter() {
35
- /// println!("{}", elem );
34
+ /// for elem in &v {
35
+ /// println!("{elem}" );
36
36
/// }
37
37
/// ```
38
38
///
You can’t perform that action at this time.
0 commit comments