mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
This commit is contained in:
commit
9e8f53d09a
207 changed files with 260 additions and 267 deletions
|
@ -117,11 +117,13 @@ impl EarlyLintPass for ModStyle {
|
|||
cx.struct_span_lint(
|
||||
SELF_NAMED_MODULE_FILES,
|
||||
Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
|
||||
|build| {
|
||||
let mut lint =
|
||||
build.build(&format!("`mod.rs` files are required, found `{}`", path.display()));
|
||||
lint.help(&format!("move `{}` to `{}`", path.display(), correct.display(),));
|
||||
lint.emit();
|
||||
format!("`mod.rs` files are required, found `{}`", path.display()),
|
||||
|lint| {
|
||||
lint.help(format!(
|
||||
"move `{}` to `{}`",
|
||||
path.display(),
|
||||
correct.display(),
|
||||
))
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -156,11 +158,8 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source
|
|||
cx.struct_span_lint(
|
||||
MOD_MODULE_FILES,
|
||||
Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
|
||||
|build| {
|
||||
let mut lint = build.build(&format!("`mod.rs` files are not allowed, found `{}`", path.display()));
|
||||
lint.help(&format!("move `{}` to `{}`", path.display(), mod_file.display(),));
|
||||
lint.emit();
|
||||
},
|
||||
format!("`mod.rs` files are not allowed, found `{}`", path.display()),
|
||||
|lint| lint.help(format!("move `{}` to `{}`", path.display(), mod_file.display())),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,10 +47,9 @@ fn docs_link(diag: &mut Diagnostic, lint: &'static Lint) {
|
|||
/// | ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/// ```
|
||||
pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<MultiSpan>, msg: &str) {
|
||||
cx.struct_span_lint(lint, sp, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
cx.struct_span_lint(lint, sp, msg, |diag| {
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -82,15 +81,14 @@ pub fn span_lint_and_help<'a, T: LintContext>(
|
|||
help_span: Option<Span>,
|
||||
help: &str,
|
||||
) {
|
||||
cx.struct_span_lint(lint, span, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
cx.struct_span_lint(lint, span, msg, |diag| {
|
||||
if let Some(help_span) = help_span {
|
||||
diag.span_help(help_span, help);
|
||||
} else {
|
||||
diag.help(help);
|
||||
}
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -125,15 +123,14 @@ pub fn span_lint_and_note<'a, T: LintContext>(
|
|||
note_span: Option<Span>,
|
||||
note: &str,
|
||||
) {
|
||||
cx.struct_span_lint(lint, span, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
cx.struct_span_lint(lint, span, msg, |diag| {
|
||||
if let Some(note_span) = note_span {
|
||||
diag.span_note(note_span, note);
|
||||
} else {
|
||||
diag.note(note);
|
||||
}
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -147,19 +144,17 @@ where
|
|||
S: Into<MultiSpan>,
|
||||
F: FnOnce(&mut Diagnostic),
|
||||
{
|
||||
cx.struct_span_lint(lint, sp, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
f(&mut diag);
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
cx.struct_span_lint(lint, sp, msg, |diag| {
|
||||
f(diag);
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
|
||||
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg, |diag| {
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -171,11 +166,10 @@ pub fn span_lint_hir_and_then(
|
|||
msg: &str,
|
||||
f: impl FnOnce(&mut Diagnostic),
|
||||
) {
|
||||
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, |diag| {
|
||||
let mut diag = diag.build(msg);
|
||||
f(&mut diag);
|
||||
docs_link(&mut diag, lint);
|
||||
diag.emit();
|
||||
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg, |diag| {
|
||||
f(diag);
|
||||
docs_link(diag, lint);
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: `std::string::String` may not be held across an `await` point per `clippy
|
|||
LL | let _x = String::from("hello");
|
||||
| ^^
|
||||
|
|
||||
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
|
||||
= note: strings are bad
|
||||
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
|
||||
|
||||
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
|
||||
--> $DIR/await_holding_invalid_type.rs:10:9
|
||||
|
|
|
@ -8,8 +8,8 @@ error: the function has a cognitive complexity of (3/2)
|
|||
LL | fn cognitive_complexity() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: used `expect()` on `an Option` value
|
|||
LL | let _ = opt.expect("");
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
= help: if this value is `None`, it will panic
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
|
||||
error: used `expect()` on `a Result` value
|
||||
--> $DIR/expect_used.rs:11:13
|
||||
|
|
|
@ -4,8 +4,8 @@ error: more than 1 bools in function parameters
|
|||
LL | fn g(_: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: attempted to include a large file
|
|||
LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::large-include-file` implied by `-D warnings`
|
||||
= note: the configuration allows a maximum size of 600 bytes
|
||||
= note: `-D clippy::large-include-file` implied by `-D warnings`
|
||||
= note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: attempted to include a large file
|
||||
|
|
|
@ -4,12 +4,12 @@ error: use of irregular braces for `vec!` macro
|
|||
LL | let _ = vec! {1, 2, 3};
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
|
||||
help: consider writing `vec![1, 2, 3]`
|
||||
--> $DIR/conf_nonstandard_macro_braces.rs:43:13
|
||||
|
|
||||
LL | let _ = vec! {1, 2, 3};
|
||||
| ^^^^^^^^^^^^^^
|
||||
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
|
||||
|
||||
error: use of irregular braces for `format!` macro
|
||||
--> $DIR/conf_nonstandard_macro_braces.rs:44:13
|
||||
|
|
|
@ -4,13 +4,13 @@ error: some fields in `NoGeneric` are not safe to be sent to another thread
|
|||
LL | unsafe impl Send for NoGeneric {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
|
||||
note: it is not safe to send field `rc_is_not_send` to another thread
|
||||
--> $DIR/test.rs:8:5
|
||||
|
|
||||
LL | rc_is_not_send: Rc<String>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: use a thread-safe type that implements `Send`
|
||||
= note: `-D clippy::non-send-fields-in-send-ty` implied by `-D warnings`
|
||||
|
||||
error: some fields in `MultiField<T>` are not safe to be sent to another thread
|
||||
--> $DIR/test.rs:19:1
|
||||
|
|
|
@ -6,8 +6,8 @@ LL | | a: bool,
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
|
||||
= help: consider using a state machine or refactoring bools into two-variant enums
|
||||
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ error: used `unwrap()` on `an Option` value
|
|||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:36:17
|
||||
|
|
|
@ -4,8 +4,8 @@ error: this comparison involving the minimum or maximum element for this type co
|
|||
LL | u <= 0;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
|
||||
= help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 0` instead
|
||||
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:15:5
|
||||
|
|
|
@ -4,12 +4,12 @@ error: `allow` attribute without specifying a reason
|
|||
LL | #[allow(dead_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/allow_attributes_without_reason.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::allow_attributes_without_reason)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: try adding a reason at the end with `, reason = ".."`
|
||||
|
||||
error: `allow` attribute without specifying a reason
|
||||
--> $DIR/allow_attributes_without_reason.rs:6:1
|
||||
|
|
|
@ -4,8 +4,8 @@ error: approximate value of `f{32, 64}::consts::E` found
|
|||
LL | let my_e = 2.7182;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::approx-constant` implied by `-D warnings`
|
||||
= help: consider using the constant directly
|
||||
= note: `-D clippy::approx-constant` implied by `-D warnings`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::E` found
|
||||
--> $DIR/approx_const.rs:5:20
|
||||
|
|
|
@ -4,8 +4,8 @@ error: using a potentially dangerous silent `as` conversion
|
|||
LL | let i = 0u32 as u64;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::as-conversions` implied by `-D warnings`
|
||||
= help: consider using a safe wrapper for this conversion
|
||||
= note: `-D clippy::as-conversions` implied by `-D warnings`
|
||||
|
||||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:17:13
|
||||
|
|
|
@ -4,8 +4,8 @@ error: Intel x86 assembly syntax used
|
|||
LL | asm!("");
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings`
|
||||
= help: use AT&T x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings`
|
||||
|
||||
error: Intel x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:9:9
|
||||
|
@ -29,8 +29,8 @@ error: AT&T x86 assembly syntax used
|
|||
LL | asm!("", options(att_syntax));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings`
|
||||
= help: use Intel x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings`
|
||||
|
||||
error: AT&T x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:24:9
|
||||
|
|
|
@ -4,8 +4,8 @@ error: `assert!(true)` will be optimized out by the compiler
|
|||
LL | assert!(true);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
|
||||
= help: remove it
|
||||
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
|
||||
|
||||
error: `assert!(false)` should probably be replaced
|
||||
--> $DIR/assertions_on_constants.rs:11:5
|
||||
|
|
|
@ -4,7 +4,6 @@ error: this `MutexGuard` is held across an `await` point
|
|||
LL | let guard = x.lock().unwrap();
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
|
||||
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
|
||||
note: these are all the `await` points this lock is held through
|
||||
--> $DIR/await_holding_lock.rs:9:9
|
||||
|
@ -13,6 +12,7 @@ LL | / let guard = x.lock().unwrap();
|
|||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:24:13
|
||||
|
|
|
@ -4,7 +4,6 @@ error: this `RefCell` reference is held across an `await` point
|
|||
LL | let b = x.borrow();
|
||||
| ^
|
||||
|
|
||||
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
|
||||
= help: ensure the reference is dropped before calling `await`
|
||||
note: these are all the `await` points this reference is held through
|
||||
--> $DIR/await_holding_refcell_ref.rs:6:5
|
||||
|
@ -13,6 +12,7 @@ LL | / let b = x.borrow();
|
|||
LL | | baz().await
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:11:9
|
||||
|
|
|
@ -4,8 +4,8 @@ error: restriction lints are not meant to be all enabled
|
|||
LL | #![warn(clippy::restriction)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
|
||||
= help: try enabling only the lints you really need
|
||||
= note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
|
||||
|
||||
error: restriction lints are not meant to be all enabled
|
||||
--> $DIR/blanket_clippy_restriction_lints.rs:5:9
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | | 0
|
|||
LL | | };
|
||||
| |_____^ help: replace with from: `i32::from(a)`
|
||||
|
|
||||
= note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
|
||||
= note: `a as i32` or `a.into()` can also be valid options
|
||||
= note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
|
||||
|
||||
error: boolean to int conversion using if
|
||||
--> $DIR/bool_to_int_with_if.rs:20:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: a `const` item with interior mutability should not be borrowed
|
|||
LL | let _ = &UNFROZEN_VARIANT; //~ ERROR interior mutability
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
= help: assign this const to a local or static variable, and use the variable here
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
|
||||
error: a `const` item with interior mutability should not be borrowed
|
||||
--> $DIR/enums.rs:37:18
|
||||
|
|
|
@ -4,8 +4,8 @@ error: a `const` item with interior mutability should not be borrowed
|
|||
LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
= help: assign this const to a local or static variable, and use the variable here
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
|
||||
error: a `const` item with interior mutability should not be borrowed
|
||||
--> $DIR/others.rs:55:16
|
||||
|
|
|
@ -4,8 +4,8 @@ error: a `const` item with interior mutability should not be borrowed
|
|||
LL | let _ = &Self::ATOMIC; //~ ERROR interior mutable
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
= help: assign this const to a local or static variable, and use the variable here
|
||||
= note: `-D clippy::borrow-interior-mutable-const` implied by `-D warnings`
|
||||
|
||||
error: a `const` item with interior mutability should not be borrowed
|
||||
--> $DIR/traits.rs:26:18
|
||||
|
|
|
@ -4,8 +4,8 @@ error: you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>
|
|||
LL | fn test1(foo: Box<Vec<bool>>) {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::box-collection` implied by `-D warnings`
|
||||
= help: `Vec<..>` is already on the heap, `Box<Vec<..>>` makes an extra allocation
|
||||
= note: `-D clippy::box-collection` implied by `-D warnings`
|
||||
|
||||
error: you seem to be trying to use `Box<String>`. Consider using just `String`
|
||||
--> $DIR/box_collection.rs:28:15
|
||||
|
|
|
@ -7,12 +7,12 @@ LL | | result
|
|||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
= note: the end suggestion probably needs some adjustments to use the expression result correctly
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_bottom.rs:2:36
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: the end suggestion probably needs some adjustments to use the expression result correctly
|
||||
help: consider moving these statements after the if
|
||||
|
|
||||
LL ~ }
|
||||
|
|
|
@ -103,11 +103,6 @@ LL | | println!("This should trigger `IS_SAME_THAN_ELSE` as usual");
|
|||
LL | | } else {
|
||||
| |_____^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: same as this
|
||||
--> $DIR/shared_at_top.rs:98:12
|
||||
|
|
||||
|
@ -116,6 +111,11 @@ LL | } else {
|
|||
LL | | println!("This should trigger `IS_SAME_THAN_ELSE` as usual");
|
||||
LL | | }
|
||||
| |_____^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@ LL | | let _overlap_start = t * 2;
|
|||
LL | | let _overlap_end = 2 * t;
|
||||
| |_________________________________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top_and_bottom.rs:2:36
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:28:5
|
||||
|
|
||||
LL | / let _u = 9;
|
||||
LL | | }
|
||||
| |_____^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top_and_bottom.rs:2:36
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: consider moving these statements before the if
|
||||
|
|
||||
LL ~ let t = 7;
|
||||
|
|
|
@ -6,11 +6,6 @@ LL | if false {
|
|||
LL | | } else {
|
||||
| |_____^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/valid_if_blocks.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:105:12
|
||||
|
|
||||
|
@ -18,6 +13,11 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | }
|
||||
| |_____^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/valid_if_blocks.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:115:15
|
||||
|
|
|
@ -4,8 +4,8 @@ error: case-sensitive file extension comparison
|
|||
LL | filename.ends_with(".rs")
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::case-sensitive-file-extension-comparisons` implied by `-D warnings`
|
||||
= help: consider using a case-insensitive comparison instead
|
||||
= note: `-D clippy::case-sensitive-file-extension-comparisons` implied by `-D warnings`
|
||||
|
||||
error: case-sensitive file extension comparison
|
||||
--> $DIR/case_sensitive_file_extension_comparisons.rs:17:27
|
||||
|
|
|
@ -4,8 +4,8 @@ error: casting a character literal to `u8` truncates
|
|||
LL | let _ = '❤' as u8; // no suggestion, since a byte literal won't work.
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
= note: `char` is four bytes wide, but `u8` is a single byte
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: casting a character literal to `u8` truncates
|
|||
LL | let _ = 'a' as u8;
|
||||
| ^^^^^^^^^ help: use a byte literal instead: `b'a'`
|
||||
|
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
= note: `char` is four bytes wide, but `u8` is a single byte
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
|
||||
error: casting a character literal to `u8` truncates
|
||||
--> $DIR/char_lit_as_u8_suggestions.rs:7:13
|
||||
|
|
|
@ -6,12 +6,12 @@ LL | if x.is_ok() && y.is_err() {
|
|||
LL | x.unwrap(); // unnecessary
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: try using `if let` or `match`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/complex_conditionals.rs:1:35
|
||||
|
|
||||
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: try using `if let` or `match`
|
||||
|
||||
error: this call to `unwrap_err()` will always panic
|
||||
--> $DIR/complex_conditionals.rs:9:9
|
||||
|
|
|
@ -4,8 +4,8 @@ error: the function has a cognitive complexity of (28/25)
|
|||
LL | fn main() {
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
|
||||
error: the function has a cognitive complexity of (7/1)
|
||||
--> $DIR/cognitive_complexity.rs:91:4
|
||||
|
|
|
@ -4,8 +4,8 @@ error: the function has a cognitive complexity of (3/0)
|
|||
LL | fn kaboom() {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
= help: you could split it up into multiple smaller functions
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ LL | | _ => return,
|
|||
LL | | },
|
||||
| |_________^
|
||||
|
|
||||
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:12:12
|
||||
|
|
||||
|
@ -16,6 +15,7 @@ LL | Ok(val) => match val {
|
|||
| ^^^ replace this binding
|
||||
LL | Some(n) => foo(n),
|
||||
| ^^^^^^^ with this pattern
|
||||
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
||||
|
||||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:21:20
|
||||
|
|
|
@ -8,7 +8,6 @@ LL | | _ => return,
|
|||
LL | | },
|
||||
| |_____________^
|
||||
|
|
||||
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match2.rs:13:16
|
||||
|
|
||||
|
@ -16,6 +15,7 @@ LL | Ok(val) if make() => match val {
|
|||
| ^^^ replace this binding
|
||||
LL | Some(n) => foo(n),
|
||||
| ^^^^^^^ with this pattern
|
||||
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
||||
|
||||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match2.rs:20:24
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | | b()
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::comparison-chain` implied by `-D warnings`
|
||||
= help: consider rewriting the `if` chain to use `cmp` and `match`
|
||||
= note: `-D clippy::comparison-chain` implied by `-D warnings`
|
||||
|
||||
error: `if` chain can be rewritten with `match`
|
||||
--> $DIR/comparison_chain.rs:27:5
|
||||
|
|
|
@ -10,8 +10,8 @@ LL | | }
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::copy-iterator` implied by `-D warnings`
|
||||
= note: consider implementing `IntoIterator` instead
|
||||
= note: `-D clippy::copy-iterator` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ error: empty `loop {}` wastes CPU cycles
|
|||
LL | loop {}
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
= help: you should either use `panic!()` or add `std::thread::sleep(..);` to the loop body
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit
|
|||
LL | FOO_REF_REF => {},
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D indirect-structural-match` implied by `-D warnings`
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
|
||||
= note: `-D indirect-structural-match` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: unsafe block missing a safety comment
|
|||
LL | unsafe { 0 };
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
= note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | | TyöValmis,
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ error: literal out of range for `u32`
|
|||
LL | let _y = 1u32 >> 10000000000000u32;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[deny(overflowing_literals)]` on by default
|
||||
= note: the literal `10000000000000u32` does not fit into the type `u32` whose range is `0..=4294967295`
|
||||
= note: `#[deny(overflowing_literals)]` on by default
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: recursing into entrypoint `a`
|
|||
LL | a();
|
||||
| ^
|
||||
|
|
||||
= note: `-D clippy::main-recursion` implied by `-D warnings`
|
||||
= help: consider using another function for this recursion
|
||||
= note: `-D clippy::main-recursion` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ LL | / a = b;
|
|||
LL | | b = a;
|
||||
| |_________^ help: try: `core::mem::swap(&mut a, &mut b)`
|
||||
|
|
||||
= note: `-D clippy::almost-swapped` implied by `-D warnings`
|
||||
= note: or maybe you should use `core::mem::replace`?
|
||||
= note: `-D clippy::almost-swapped` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: recursing into entrypoint `main`
|
|||
LL | main();
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::main-recursion` implied by `-D warnings`
|
||||
= help: consider using another function for this recursion
|
||||
= note: `-D clippy::main-recursion` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: methods called `as_*` usually take `self` by reference or `self` by mutab
|
|||
LL | pub fn as_ref(self) -> &'static str {
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
|
||||
= help: consider choosing a less ambiguous name
|
||||
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | | b: u32,
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::default-union-representation` implied by `-D warnings`
|
||||
= help: consider annotating `NoAttribute` with `#[repr(C)]` to explicitly specify memory layout
|
||||
= note: `-D clippy::default-union-representation` implied by `-D warnings`
|
||||
|
||||
error: this union has the default representation
|
||||
--> $DIR/default_union_representation.rs:16:1
|
||||
|
|
|
@ -8,7 +8,6 @@ LL | | }
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
|
||||
note: consider deriving `Clone` or removing `Copy`
|
||||
--> $DIR/derive.rs:8:1
|
||||
|
|
||||
|
@ -18,6 +17,7 @@ LL | | Qux
|
|||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
|
||||
|
||||
error: you are implementing `Clone` explicitly on a `Copy` type
|
||||
--> $DIR/derive.rs:32:1
|
||||
|
|
|
@ -4,12 +4,12 @@ error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
|||
LL | #[derive(Hash)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: `#[deny(clippy::derive_hash_xor_eq)]` on by default
|
||||
note: `PartialEq` implemented here
|
||||
--> $DIR/derive_hash_xor_eq.rs:15:1
|
||||
|
|
||||
LL | impl PartialEq for Bar {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `#[deny(clippy::derive_hash_xor_eq)]` on by default
|
||||
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
|
||||
|
|
|
@ -4,12 +4,12 @@ error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
|
|||
LL | #[derive(Ord, PartialEq, Eq)]
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::derive-ord-xor-partial-ord` implied by `-D warnings`
|
||||
note: `PartialOrd` implemented here
|
||||
--> $DIR/derive_ord_xor_partial_ord.rs:24:1
|
||||
|
|
||||
LL | impl PartialOrd for DeriveOrd {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D clippy::derive-ord-xor-partial-ord` implied by `-D warnings`
|
||||
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | | /// Because of the initial `unbalanced_tick` pair, the error message is
|
|||
LL | | /// very `confusing_and_misleading`.
|
||||
| |____________________________________^
|
||||
|
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
= help: a backtick may be missing a pair
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
|
||||
error: backticks are unbalanced
|
||||
--> $DIR/unbalanced_ticks.rs:13:1
|
||||
|
|
|
@ -4,8 +4,8 @@ error: this function has an empty `#[must_use]` attribute, but returns a type al
|
|||
LL | pub fn must_use_result() -> Result<(), ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::double-must-use` implied by `-D warnings`
|
||||
= help: either add some descriptive text or remove the attribute
|
||||
= note: `-D clippy::double-must-use` implied by `-D warnings`
|
||||
|
||||
error: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`
|
||||
--> $DIR/double_must_use.rs:10:1
|
||||
|
|
|
@ -4,12 +4,12 @@ error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a
|
|||
LL | drop(s1);
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::drop-copy` implied by `-D warnings`
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/drop_forget_copy.rs:33:10
|
||||
|
|
||||
LL | drop(s1);
|
||||
| ^^
|
||||
= note: `-D clippy::drop-copy` implied by `-D warnings`
|
||||
|
||||
error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
|
||||
--> $DIR/drop_forget_copy.rs:34:5
|
||||
|
@ -41,12 +41,12 @@ error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetti
|
|||
LL | forget(s1);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::forget-copy` implied by `-D warnings`
|
||||
note: argument has type `SomeStruct`
|
||||
--> $DIR/drop_forget_copy.rs:39:12
|
||||
|
|
||||
LL | forget(s1);
|
||||
| ^^
|
||||
= note: `-D clippy::forget-copy` implied by `-D warnings`
|
||||
|
||||
error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact
|
||||
--> $DIR/drop_forget_copy.rs:40:5
|
||||
|
|
|
@ -4,12 +4,12 @@ error: call to `std::mem::drop` with a value that does not implement `Drop`. Dro
|
|||
LL | drop(Foo);
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::drop-non-drop` implied by `-D warnings`
|
||||
note: argument has type `main::Foo`
|
||||
--> $DIR/drop_non_drop.rs:22:10
|
||||
|
|
||||
LL | drop(Foo);
|
||||
| ^^^
|
||||
= note: `-D clippy::drop-non-drop` implied by `-D warnings`
|
||||
|
||||
error: call to `std::mem::drop` with a value that does not implement `Drop`. Dropping such a type only extends its contained lifetimes
|
||||
--> $DIR/drop_non_drop.rs:37:5
|
||||
|
|
|
@ -4,12 +4,12 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
|
|||
LL | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::drop-ref` implied by `-D warnings`
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/drop_ref.rs:11:10
|
||||
|
|
||||
LL | drop(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
= note: `-D clippy::drop-ref` implied by `-D warnings`
|
||||
|
||||
error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
|
||||
--> $DIR/drop_ref.rs:14:5
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | | println!("else if");
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::else-if-without-else` implied by `-D warnings`
|
||||
= help: add an `else` block here
|
||||
= note: `-D clippy::else-if-without-else` implied by `-D warnings`
|
||||
|
||||
error: `if` expression with an `else if`, but without a final `else`
|
||||
--> $DIR/else_if_without_else.rs:54:12
|
||||
|
|
|
@ -4,8 +4,8 @@ error: enum with no variants
|
|||
LL | enum Empty {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::empty-enum` implied by `-D warnings`
|
||||
= help: consider using the uninhabited type `!` (never type) or a wrapper around it to introduce a type which can't be instantiated
|
||||
= note: `-D clippy::empty-enum` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: empty `loop {}` wastes CPU cycles
|
|||
LL | loop {}
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
= help: you should either use `panic!()` or add `std::thread::sleep(..);` to the loop body
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
|
||||
error: empty `loop {}` wastes CPU cycles
|
||||
--> $DIR/empty_loop.rs:11:9
|
||||
|
|
|
@ -4,8 +4,8 @@ error: empty `loop {}` wastes CPU cycles
|
|||
LL | loop {}
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
= help: you should either use `panic!()` or add a call pausing or sleeping the thread to the loop body
|
||||
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
||||
|
||||
error: empty `loop {}` wastes CPU cycles
|
||||
--> $DIR/empty_loop_no_std.rs:25:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: used `expect()` on `an Option` value
|
|||
LL | let _ = opt.expect("");
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
= help: if this value is `None`, it will panic
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
|
||||
error: used `expect()` on `a Result` value
|
||||
--> $DIR/expect.rs:10:13
|
||||
|
|
|
@ -8,17 +8,17 @@ LL | | }
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/fallible_impl_from.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::fallible_impl_from)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
|
||||
note: potential failure(s)
|
||||
--> $DIR/fallible_impl_from.rs:7:13
|
||||
|
|
||||
LL | Foo(s.parse().unwrap())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/fallible_impl_from.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::fallible_impl_from)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:26:1
|
||||
|
|
|
@ -4,12 +4,12 @@ error: field assignment outside of initializer for an instance created with Defa
|
|||
LL | a.i = 42;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
|
||||
note: consider initializing the variable with `main::A { i: 42, ..Default::default() }` and removing relevant reassignments
|
||||
--> $DIR/field_reassign_with_default.rs:62:5
|
||||
|
|
||||
LL | let mut a: A = Default::default();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
|
||||
|
||||
error: field assignment outside of initializer for an instance created with Default::default()
|
||||
--> $DIR/field_reassign_with_default.rs:103:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: `FileType::is_file()` only covers regular files
|
|||
LL | if fs::metadata("foo.txt")?.file_type().is_file() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::filetype-is-file` implied by `-D warnings`
|
||||
= help: use `!FileType::is_dir()` instead
|
||||
= note: `-D clippy::filetype-is-file` implied by `-D warnings`
|
||||
|
||||
error: `!FileType::is_file()` only denies regular files
|
||||
--> $DIR/filetype_is_file.rs:13:8
|
||||
|
|
|
@ -4,8 +4,8 @@ error: strict comparison of `f32` or `f64`
|
|||
LL | ONE as f64 != 2.0;
|
||||
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin`
|
||||
|
|
||||
= note: `-D clippy::float-cmp` implied by `-D warnings`
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
= note: `-D clippy::float-cmp` implied by `-D warnings`
|
||||
|
||||
error: strict comparison of `f32` or `f64`
|
||||
--> $DIR/float_cmp.rs:62:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: strict comparison of `f32` or `f64` constant
|
|||
LL | 1f32 == ONE;
|
||||
| ^^^^^^^^^^^ help: consider comparing them within some margin of error: `(1f32 - ONE).abs() < error_margin`
|
||||
|
|
||||
= note: `-D clippy::float-cmp-const` implied by `-D warnings`
|
||||
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
|
||||
= note: `-D clippy::float-cmp-const` implied by `-D warnings`
|
||||
|
||||
error: strict comparison of `f32` or `f64` constant
|
||||
--> $DIR/float_cmp_const.rs:17:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: more than 3 bools in function parameters
|
|||
LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:21:1
|
||||
|
|
|
@ -4,8 +4,8 @@ error: for loop over `option`, which is an `Option`. This is more readably writt
|
|||
LL | for x in option {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
|
||||
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
||||
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
|
||||
|
||||
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:14:14
|
||||
|
|
|
@ -4,12 +4,12 @@ error: call to `std::mem::forget` with a value that does not implement `Drop`. F
|
|||
LL | forget(Foo);
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::forget-non-drop` implied by `-D warnings`
|
||||
note: argument has type `main::Foo`
|
||||
--> $DIR/forget_non_drop.rs:13:12
|
||||
|
|
||||
LL | forget(Foo);
|
||||
| ^^^
|
||||
= note: `-D clippy::forget-non-drop` implied by `-D warnings`
|
||||
|
||||
error: call to `std::mem::forget` with a value that does not implement `Drop`. Forgetting such a type is the same as dropping it
|
||||
--> $DIR/forget_non_drop.rs:24:5
|
||||
|
|
|
@ -4,12 +4,12 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
|
|||
LL | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::forget-ref` implied by `-D warnings`
|
||||
note: argument has type `&SomeStruct`
|
||||
--> $DIR/forget_ref.rs:11:12
|
||||
|
|
||||
LL | forget(&SomeStruct);
|
||||
| ^^^^^^^^^^^
|
||||
= note: `-D clippy::forget-ref` implied by `-D warnings`
|
||||
|
||||
error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
|
||||
--> $DIR/forget_ref.rs:14:5
|
||||
|
|
|
@ -4,9 +4,9 @@ error: `format!` in `println!` args
|
|||
LL | println!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::format-in-format-args` implied by `-D warnings`
|
||||
= help: combine the `format!(..)` arguments with the outer `println!(..)` call
|
||||
= help: or consider changing `format!` to `format_args!`
|
||||
= note: `-D clippy::format-in-format-args` implied by `-D warnings`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:28:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: `format!(..)` appended to existing `String`
|
|||
LL | string += &format!("{:?}", 1234);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::format-push-string` implied by `-D warnings`
|
||||
= help: consider using `write!` to avoid the extra allocation
|
||||
= note: `-D clippy::format-push-string` implied by `-D warnings`
|
||||
|
||||
error: `format!(..)` appended to existing `String`
|
||||
--> $DIR/format_push_string.rs:6:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: this looks like you are trying to use `.. -= ..`, but you really are doin
|
|||
LL | a =- 35;
|
||||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::suspicious-assignment-formatting` implied by `-D warnings`
|
||||
= note: to remove this lint, use either `-=` or `= -`
|
||||
= note: `-D clippy::suspicious-assignment-formatting` implied by `-D warnings`
|
||||
|
||||
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
|
||||
--> $DIR/formatting.rs:17:6
|
||||
|
@ -29,8 +29,8 @@ error: possibly missing a comma here
|
|||
LL | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
|
|
||||
= note: `-D clippy::possible-missing-comma` implied by `-D warnings`
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
= note: `-D clippy::possible-missing-comma` implied by `-D warnings`
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:33:19
|
||||
|
|
|
@ -4,8 +4,8 @@ error: an implementation of `From` is preferred since it gives you `Into<_>` for
|
|||
LL | impl Into<StringWrapper> for String {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::from-over-into` implied by `-D warnings`
|
||||
= help: consider to implement `From<std::string::String>` instead
|
||||
= note: `-D clippy::from-over-into` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ error: future cannot be sent between threads safely
|
|||
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
|
||||
| ^^^^ future returned by `private_future` is not `Send`
|
||||
|
|
||||
= note: `-D clippy::future-not-send` implied by `-D warnings`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/future_not_send.rs:8:19
|
||||
|
|
||||
|
@ -25,6 +24,7 @@ LL | async { true }.await
|
|||
LL | }
|
||||
| - `cell` is later dropped here
|
||||
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
|
||||
= note: `-D clippy::future-not-send` implied by `-D warnings`
|
||||
|
||||
error: future cannot be sent between threads safely
|
||||
--> $DIR/future_not_send.rs:11:42
|
||||
|
|
|
@ -16,8 +16,8 @@ error: used `unwrap()` on `an Option` value
|
|||
LL | let _ = boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:36:17
|
||||
|
|
|
@ -13,8 +13,8 @@ LL | | do_stuff(lock);
|
|||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::if-let-mutex` implied by `-D warnings`
|
||||
= help: move the lock call outside of the `if let ...` expression
|
||||
= note: `-D clippy::if-let-mutex` implied by `-D warnings`
|
||||
|
||||
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
|
||||
--> $DIR/if_let_mutex.rs:22:5
|
||||
|
|
|
@ -8,8 +8,8 @@ LL | | println!("Bunny");
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::if-not-else` implied by `-D warnings`
|
||||
= help: remove the `!` and swap the blocks of the `if`/`else`
|
||||
= note: `-D clippy::if-not-else` implied by `-D warnings`
|
||||
|
||||
error: unnecessary `!=` operation
|
||||
--> $DIR/if_not_else.rs:17:5
|
||||
|
|
|
@ -11,7 +11,6 @@ LL | | foo();
|
|||
LL | | } else {
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
||||
note: same as this
|
||||
--> $DIR/if_same_then_else.rs:31:12
|
||||
|
|
||||
|
@ -24,6 +23,7 @@ LL | | 0..10;
|
|||
LL | | foo();
|
||||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/if_same_then_else.rs:67:21
|
||||
|
|
|
@ -11,7 +11,6 @@ LL | | }
|
|||
LL | | } else {
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
||||
note: same as this
|
||||
--> $DIR/if_same_then_else2.rs:23:12
|
||||
|
|
||||
|
@ -24,6 +23,7 @@ LL | | let bar: &Option<_> = &Some::<u8>(42);
|
|||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/if_same_then_else2.rs:35:13
|
||||
|
|
|
@ -10,8 +10,8 @@ LL | | None
|
|||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::if-then-some-else-none` implied by `-D warnings`
|
||||
= help: consider using `bool::then` like: `foo().then(|| { /* snippet */ "foo" })`
|
||||
= note: `-D clippy::if-then-some-else-none` implied by `-D warnings`
|
||||
|
||||
error: this could be simplified with `bool::then`
|
||||
--> $DIR/if_then_some_else_none.rs:14:13
|
||||
|
|
|
@ -4,12 +4,12 @@ error: this `if` has the same condition as a previous `if`
|
|||
LL | } else if b {
|
||||
| ^
|
||||
|
|
||||
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
|
||||
note: same as this
|
||||
--> $DIR/ifs_same_cond.rs:8:8
|
||||
|
|
||||
LL | if b {
|
||||
| ^
|
||||
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
|
||||
|
||||
error: this `if` has the same condition as a previous `if`
|
||||
--> $DIR/ifs_same_cond.rs:14:15
|
||||
|
|
|
@ -6,7 +6,6 @@ LL | | fn second() {}
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::multiple-inherent-impl` implied by `-D warnings`
|
||||
note: first implementation here
|
||||
--> $DIR/impl.rs:6:1
|
||||
|
|
||||
|
@ -14,6 +13,7 @@ LL | / impl MyStruct {
|
|||
LL | | fn first() {}
|
||||
LL | | }
|
||||
| |_^
|
||||
= note: `-D clippy::multiple-inherent-impl` implied by `-D warnings`
|
||||
|
||||
error: multiple implementations of this structure
|
||||
--> $DIR/impl.rs:24:5
|
||||
|
|
|
@ -16,8 +16,8 @@ error: indexing may panic
|
|||
LL | x[index];
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/indexing_slicing_index.rs:38:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: slicing may panic
|
|||
LL | &x[index..];
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
= help: consider using `.get(n..)` or .get_mut(n..)` instead
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
|
||||
error: slicing may panic
|
||||
--> $DIR/indexing_slicing_slice.rs:13:6
|
||||
|
|
|
@ -4,12 +4,12 @@ error: calling `to_string` on `&&str`
|
|||
LL | let _: String = rrstr.to_string();
|
||||
| ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrstr).to_string()`
|
||||
|
|
||||
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/inefficient_to_string.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::inefficient_to_string)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: `&str` implements `ToString` through a slower blanket impl, but `str` has a fast specialization of `ToString`
|
||||
|
||||
error: calling `to_string` on `&&&str`
|
||||
--> $DIR/inefficient_to_string.rs:12:21
|
||||
|
|
|
@ -4,8 +4,8 @@ error: variables in the condition are not mutated in the loop body
|
|||
LL | while y < 10 {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `#[deny(clippy::while_immutable_condition)]` on by default
|
||||
= note: this may lead to an infinite or to a never running loop
|
||||
= note: `#[deny(clippy::while_immutable_condition)]` on by default
|
||||
|
||||
error: variables in the condition are not mutated in the loop body
|
||||
--> $DIR/infinite_loop.rs:25:11
|
||||
|
|
|
@ -6,8 +6,8 @@ LL | | "A.to_string()".to_string()
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::inherent-to-string` implied by `-D warnings`
|
||||
= help: implement trait `Display` for type `A` instead
|
||||
= note: `-D clippy::inherent-to-string` implied by `-D warnings`
|
||||
|
||||
error: type `C` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`
|
||||
--> $DIR/inherent_to_string.rs:44:5
|
||||
|
@ -17,12 +17,12 @@ LL | | "C.to_string()".to_string()
|
|||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
= help: remove the inherent method from type `C`
|
||||
note: the lint level is defined here
|
||||
--> $DIR/inherent_to_string.rs:2:9
|
||||
|
|
||||
LL | #![deny(clippy::inherent_to_string_shadow_display)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: remove the inherent method from type `C`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ LL | | b.push(z);
|
|||
LL | | });
|
||||
| |______^
|
||||
|
|
||||
= note: `-D clippy::inspect-for-each` implied by `-D warnings`
|
||||
= help: move the code from `inspect(..)` to `for_each(..)` and remove the `inspect(..)`
|
||||
= note: `-D clippy::inspect-for-each` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: integer division
|
|||
LL | let n = 1 / 2;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::integer-division` implied by `-D warnings`
|
||||
= help: division of integers may cause loss of precision. consider using floats
|
||||
= note: `-D clippy::integer-division` implied by `-D warnings`
|
||||
|
||||
error: integer division
|
||||
--> $DIR/integer_division.rs:6:13
|
||||
|
|
|
@ -18,8 +18,8 @@ error: methods called `new` usually take no `self`
|
|||
LL | pub async fn new(&mut self) -> Self {
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
|
||||
= help: consider choosing a less ambiguous name
|
||||
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error: called `.iter().nth()` on a Vec
|
|||
LL | let bad_vec = some_vec.iter().nth(3);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::iter-nth` implied by `-D warnings`
|
||||
= help: calling `.get()` is both faster and more readable
|
||||
= note: `-D clippy::iter-nth` implied by `-D warnings`
|
||||
|
||||
error: called `.iter().nth()` on a slice
|
||||
--> $DIR/iter_nth.rs:34:26
|
||||
|
|
|
@ -4,12 +4,12 @@ error: called `skip(..).next()` on an iterator
|
|||
LL | let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect();
|
||||
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
||||
|
|
||||
= note: `-D clippy::iter-skip-next` implied by `-D warnings`
|
||||
help: for this change `sp` has to be mutable
|
||||
--> $DIR/iter_skip_next_unfixable.rs:8:9
|
||||
|
|
||||
LL | let sp = test_string.split('|').map(|s| s.trim());
|
||||
| ^^
|
||||
= note: `-D clippy::iter-skip-next` implied by `-D warnings`
|
||||
|
||||
error: called `skip(..).next()` on an iterator
|
||||
--> $DIR/iter_skip_next_unfixable.rs:11:29
|
||||
|
|
|
@ -4,8 +4,8 @@ error: allocating a local array larger than 512000 bytes
|
|||
LL | [0u32; 20_000_000],
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::large-stack-arrays` implied by `-D warnings`
|
||||
= help: consider allocating on the heap with `vec![0u32; 20_000_000].into_boxed_slice()`
|
||||
= note: `-D clippy::large-stack-arrays` implied by `-D warnings`
|
||||
|
||||
error: allocating a local array larger than 512000 bytes
|
||||
--> $DIR/large_stack_arrays.rs:24:9
|
||||
|
|
|
@ -92,8 +92,8 @@ error: this returns a `Result<_, ()>`
|
|||
LL | pub fn len(&self) -> Result<usize, ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::result-unit-err` implied by `-D warnings`
|
||||
= help: use a custom `Error` type instead
|
||||
= note: `-D clippy::result-unit-err` implied by `-D warnings`
|
||||
|
||||
error: this returns a `Result<_, ()>`
|
||||
--> $DIR/len_without_is_empty.rs:240:5
|
||||
|
|
|
@ -7,8 +7,8 @@ LL | | foo = 42;
|
|||
LL | | }
|
||||
| |_____^ help: it is more idiomatic to write: `let <mut> foo = if f() { 42 } else { 0 };`
|
||||
|
|
||||
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
|
||||
= note: you might not need `mut` at all
|
||||
= note: `-D clippy::useless-let-if-seq` implied by `-D warnings`
|
||||
|
||||
error: `if _ { .. } else { .. }` is an expression
|
||||
--> $DIR/let_if_seq.rs:71:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: non-binding `let` on a type that implements `Drop`
|
|||
LL | let _ = Box::new(());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::let-underscore-drop` implied by `-D warnings`
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
= note: `-D clippy::let-underscore-drop` implied by `-D warnings`
|
||||
|
||||
error: non-binding `let` on a type that implements `Drop`
|
||||
--> $DIR/let_underscore_drop.rs:18:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: non-binding let on a synchronization lock
|
|||
LL | let _ = m.lock();
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::let-underscore-lock` implied by `-D warnings`
|
||||
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
|
||||
= note: `-D clippy::let-underscore-lock` implied by `-D warnings`
|
||||
|
||||
error: non-binding let on a synchronization lock
|
||||
--> $DIR/let_underscore_lock.rs:10:5
|
||||
|
|
|
@ -4,8 +4,8 @@ error: non-binding let on a result of a `#[must_use]` function
|
|||
LL | let _ = f();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::let-underscore-must-use` implied by `-D warnings`
|
||||
= help: consider explicitly using function result
|
||||
= note: `-D clippy::let-underscore-must-use` implied by `-D warnings`
|
||||
|
||||
error: non-binding let on an expression with `#[must_use]` type
|
||||
--> $DIR/let_underscore_must_use.rs:68:5
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue