Skip to content

Commit

Permalink
Address review comments and (Hopefully) fix CI
Browse files Browse the repository at this point in the history
Thanks
  • Loading branch information
xFrednet committed Jul 20, 2022
1 parent 996564b commit dbb93b9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
11 changes: 5 additions & 6 deletions src/doc/rustc/src/lints/levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ talk about later in this section.
## expect

Sometimes, it can be helpful to suppress lints, but at the same time ensure that
the code in question still emits them. The 'expect' level does exactly this, with
it a lint can be expected. If the lint in question is not an emitted, a new lint
`unfulfilled_lint_expectation` at the attribute notifying you that the expectation,
is no longer fulfilled.
the code in question still emits them. The 'expect' level does exactly this. If
the lint in question is not emitted, the `unfulfilled_lint_expectation` lint
triggers on the `expect` attribute, notifying you that the expectation is no
longer fulfilled.

```rust
fn main() {
#[expect(unused_variables)]
let unused = "Everyone ignores me";

#[expect(unused_variables)]
let used = "I'm usefull";
let used = "I'm useful";
println!("The `used` value is equal to: {:?}", used);
}
```
Expand All @@ -67,7 +67,6 @@ warning: this lint expectation is unfulfilled

This level can only be defined via the `#[expect]` attribute and not via the
console. Lints with the special 'force-warn' lint will still be emitted as usual.
The fulfillment of expectations is still tracked.

## warn

Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/tests/ui/let_unit.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// run-rustfix

#![feature(lint_reasons)]
#![warn(clippy::let_unit_value)]
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]

Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/tests/ui/let_unit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// run-rustfix

#![feature(lint_reasons)]
#![warn(clippy::let_unit_value)]
#![allow(unused, clippy::no_effect, clippy::needless_late_init, path_statements)]

Expand Down
20 changes: 10 additions & 10 deletions src/tools/clippy/tests/ui/let_unit.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: this let-binding has unit value
--> $DIR/let_unit.rs:14:5
--> $DIR/let_unit.rs:13:5
|
LL | let _x = println!("x");
| ^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `println!("x");`
|
= note: `-D clippy::let-unit-value` implied by `-D warnings`

error: this let-binding has unit value
--> $DIR/let_unit.rs:18:9
--> $DIR/let_unit.rs:17:9
|
LL | let _a = ();
| ^^^^^^^^^^^^ help: omit the `let` binding: `();`

error: this let-binding has unit value
--> $DIR/let_unit.rs:53:5
--> $DIR/let_unit.rs:52:5
|
LL | / let _ = v
LL | | .into_iter()
Expand All @@ -36,43 +36,43 @@ LL + .unwrap();
|

error: this let-binding has unit value
--> $DIR/let_unit.rs:80:5
--> $DIR/let_unit.rs:79:5
|
LL | let x: () = f(); // Lint.
| ^^^^-^^^^^^^^^^^
| |
| help: use a wild (`_`) binding: `_`

error: this let-binding has unit value
--> $DIR/let_unit.rs:83:5
--> $DIR/let_unit.rs:82:5
|
LL | let x: () = f2(0i32); // Lint.
| ^^^^-^^^^^^^^^^^^^^^^
| |
| help: use a wild (`_`) binding: `_`

error: this let-binding has unit value
--> $DIR/let_unit.rs:85:5
--> $DIR/let_unit.rs:84:5
|
LL | let _: () = f3(()); // Lint
| ^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `f3(());`

error: this let-binding has unit value
--> $DIR/let_unit.rs:86:5
--> $DIR/let_unit.rs:85:5
|
LL | let x: () = f3(()); // Lint
| ^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `f3(());`

error: this let-binding has unit value
--> $DIR/let_unit.rs:102:5
--> $DIR/let_unit.rs:101:5
|
LL | let x: () = if true { f() } else { f2(0) }; // Lint
| ^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: use a wild (`_`) binding: `_`

error: this let-binding has unit value
--> $DIR/let_unit.rs:113:5
--> $DIR/let_unit.rs:112:5
|
LL | / let _: () = match Some(0) {
LL | | None => f2(1),
Expand All @@ -93,7 +93,7 @@ LL + };
|

error: this let-binding has unit value
--> $DIR/let_unit.rs:160:13
--> $DIR/let_unit.rs:159:13
|
LL | let _: () = z;
| ^^^^^^^^^^^^^^ help: omit the `let` binding: `z;`
Expand Down

0 comments on commit dbb93b9

Please sign in to comment.