mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
Adjust clippy tests with new rustc help suggestion for lints
This commit is contained in:
parent
a0ebcc38d4
commit
a86e758228
751 changed files with 838 additions and 0 deletions
|
@ -5,6 +5,7 @@ LL | std::f32::MAX;
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::absolute-paths` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
|
||||
|
||||
error: consider bringing this path into scope with the `use` keyword
|
||||
--> $DIR/absolute_paths.rs:41:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | std::f32::MAX;
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::absolute-paths` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
|
||||
|
||||
error: consider bringing this path into scope with the `use` keyword
|
||||
--> $DIR/absolute_paths.rs:41:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | println!("val='{}'", local_i32);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::uninlined-format-args` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
|
||||
help: change this to
|
||||
|
|
||||
LL - println!("val='{}'", local_i32);
|
||||
|
@ -30,6 +31,7 @@ LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
|
|||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::print-literal` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_literal)]`
|
||||
help: try
|
||||
|
|
||||
LL - println!("Hello {} is {:.*}", "x", local_i32, local_f64);
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = Baz + Baz;
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects_allowed.rs:80:13
|
||||
|
|
|
@ -7,6 +7,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
|
|||
| help: make this a static item: `static`
|
||||
|
|
||||
= note: `-D clippy::large-const-arrays` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]`
|
||||
|
||||
error: allocating a local array larger than 10 bytes
|
||||
--> $DIR/array_size_threshold.rs:4:25
|
||||
|
@ -16,6 +17,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
|
|||
|
|
||||
= help: consider allocating on the heap with `vec![0; 11].into_boxed_slice()`
|
||||
= note: `-D clippy::large-stack-arrays` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_stack_arrays)]`
|
||||
|
||||
error: allocating a local array larger than 10 bytes
|
||||
--> $DIR/array_size_threshold.rs:8:17
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let _x = String::from("hello");
|
|||
|
|
||||
= note: strings are bad (from clippy.toml)
|
||||
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_invalid_type)]`
|
||||
|
||||
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
|
||||
--> $DIR/await_holding_invalid_type.rs:10:9
|
||||
|
|
|
@ -18,6 +18,7 @@ LL | fn cognitive_complexity() {
|
|||
|
|
||||
= help: you could split it up into multiple smaller functions
|
||||
= note: `-D clippy::cognitive-complexity` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cognitive_complexity)]`
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::dbg-macro` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::dbg_macro)]`
|
||||
help: remove the invocation before committing it to a version control system
|
||||
|
|
||||
LL | if let Some(n) = n.checked_sub(4) { n } else { n }
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | println!("one");
|
|||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-macros` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_macros)]`
|
||||
|
||||
error: use of a disallowed macro `std::println`
|
||||
--> $DIR/disallowed_macros.rs:11:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let foo = "bar";
|
|||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: use of a disallowed/placeholder name `ducks`
|
||||
--> $DIR/disallowed_names.rs:7:9
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let ducks = ["quack", "quack"];
|
|||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and sh
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
|
||||
help: try
|
||||
|
|
||||
LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | /// OAuth and LaTeX are inside Clippy's default list.
|
|||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::doc-markdown` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
|
||||
help: try
|
||||
|
|
||||
LL | /// `OAuth` and LaTeX are inside Clippy's default list.
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let w = { 3 };
|
|||
|
|
||||
= help: try refactoring your code to minimize nesting
|
||||
= note: `-D clippy::excessive-nesting` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::excessive_nesting)]`
|
||||
|
||||
error: this block is too nested
|
||||
--> $DIR/excessive_nesting.rs:67:17
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let _ = opt.expect("");
|
|||
|
|
||||
= note: if this value is `None`, it will panic
|
||||
= note: `-D clippy::expect-used` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::expect_used)]`
|
||||
|
||||
error: used `expect()` on a `Result` value
|
||||
--> $DIR/expect_used.rs:12:13
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | fn g(_: bool, _: bool) {}
|
|||
|
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
= note: `-D clippy::fn-params-excessive-bools` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::fn_params_excessive_bools)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ LL | | }
|
|||
| |_^
|
||||
|
|
||||
= note: `-D clippy::too-many-lines` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::too_many_lines)]`
|
||||
|
||||
error: this function has too many lines (4/1)
|
||||
--> $DIR/test.rs:25:1
|
||||
|
|
|
@ -10,6 +10,7 @@ note: same as this
|
|||
LL | if x.get() {
|
||||
| ^^^^^^^
|
||||
= note: `-D clippy::ifs-same-cond` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::ifs_same_cond)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | should_warn().await;
|
|||
| ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())`
|
||||
|
|
||||
= note: `-D clippy::large-futures` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_futures)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
|
|||
|
|
||||
= note: the configuration allows a maximum size of 600 bytes
|
||||
= note: `-D clippy::large-include-file` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::large_include_file)]`
|
||||
= 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
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _fail1 = 100_200_300.123456789;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
|
||||
|
|
||||
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inconsistent_digit_grouping)]`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/test.rs:22:18
|
||||
|
@ -13,6 +14,7 @@ LL | let _fail2 = 100200300.300200100;
|
|||
| ^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.300_200_100`
|
||||
|
|
||||
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | use extern_types::Aaa;
|
|||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::min-ident-chars` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::min_ident_chars)]`
|
||||
|
||||
error: this ident is too short (3 <= 3)
|
||||
--> $DIR/min_ident_chars.rs:10:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _: Option<u64> = Some(&16).map(|b| *b);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()`
|
||||
|
|
||||
= note: `-D clippy::map-clone` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::map_clone)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | use std::process::{exit as wrong_exit, Child as Kid};
|
|||
| ^^^^^^^^^^^^^^^^^^ help: try: `exit as goodbye`
|
||||
|
|
||||
= note: `-D clippy::missing-enforced-import-renames` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::missing_enforced_import_renames)]`
|
||||
|
||||
error: this import should be renamed
|
||||
--> $DIR/conf_missing_enforced_import_rename.rs:6:1
|
||||
|
|
|
@ -7,6 +7,7 @@ LL | | }
|
|||
| |_________^
|
||||
|
|
||||
= note: `-D clippy::module-inception` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::module_inception)]`
|
||||
|
||||
error: module has the same name as its containing module
|
||||
--> $DIR/module_inception.rs:11:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = vec! {1, 2, 3};
|
|||
| ^^^^^^^^^^^^^^ help: consider writing: `vec![1, 2, 3]`
|
||||
|
|
||||
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::nonstandard_macro_braces)]`
|
||||
|
||||
error: use of irregular braces for `format!` macro
|
||||
--> $DIR/conf_nonstandard_macro_braces.rs:44:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | print!("{n}");
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::print-stdout` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_stdout)]`
|
||||
|
||||
error: use of `eprint!`
|
||||
--> $DIR/print_macro.rs:7:5
|
||||
|
@ -13,6 +14,7 @@ LL | eprint!("{n}");
|
|||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::print-stderr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::print_stderr)]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | pub(crate) fn crate_no_docs() {}
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::missing_docs_in_private_items)]`
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/pub_crate_missing_doc.rs:15:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | { unit_fn_block(); }
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::semicolon-outside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_outside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL - { unit_fn_block(); }
|
||||
|
@ -33,6 +34,7 @@ LL | | };
|
|||
| |______^
|
||||
|
|
||||
= note: `-D clippy::semicolon-inside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_inside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ unit_fn_block();
|
||||
|
|
|
@ -8,6 +8,7 @@ LL | | };
|
|||
| |______^
|
||||
|
|
||||
= note: `-D clippy::semicolon-inside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_inside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ unit_fn_block();
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | { unit_fn_block(); }
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::semicolon-outside-block` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::semicolon_outside_block)]`
|
||||
help: put the `;` here
|
||||
|
|
||||
LL - { unit_fn_block(); }
|
||||
|
|
|
@ -11,6 +11,7 @@ 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`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::non_send_fields_in_send_ty)]`
|
||||
|
||||
error: some fields in `MultiField<T>` are not safe to be sent to another thread
|
||||
--> $DIR/test.rs:19:1
|
||||
|
|
|
@ -8,6 +8,7 @@ LL | | }
|
|||
|
|
||||
= help: consider using a state machine or refactoring bools into two-variant enums
|
||||
= note: `-D clippy::struct-excessive-bools` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::struct_excessive_bools)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ LL | x[index];
|
|||
|
|
||||
= help: consider using `.get(n)` or `.get_mut(n)` instead
|
||||
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
|
||||
|
||||
error: indexing may panic
|
||||
--> $DIR/test.rs:46:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | fn test(toto: ()) {}
|
|||
| ^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-names` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
|
||||
|
||||
error: use of a disallowed/placeholder name `toto`
|
||||
--> $DIR/conf_french_disallowed_name.rs:9:9
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let re = Regex::new(r"ab.*c").unwrap();
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_methods)]`
|
||||
|
||||
error: use of a disallowed method `regex::Regex::is_match`
|
||||
--> $DIR/conf_disallowed_methods.rs:36:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | use std::sync::atomic::AtomicU32;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::disallowed-types` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::disallowed_types)]`
|
||||
|
||||
error: `std::time::Instant` is not allowed according to config
|
||||
--> $DIR/conf_disallowed_types.rs:8:1
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | fn bad(x: &u16, y: &Foo) {}
|
|||
| ^^^^ help: consider passing by value instead: `u16`
|
||||
|
|
||||
= note: `-D clippy::trivially-copy-pass-by-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
|
||||
|
||||
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
|
||||
--> $DIR/test.rs:15:20
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | /* Safety: */ unsafe {}
|
|||
|
|
||||
= help: consider adding a safety comment on the preceding line
|
||||
= note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
|
||||
|
||||
error: unsafe block missing a safety comment
|
||||
--> $DIR/undocumented_unsafe_blocks.rs:267:5
|
||||
|
@ -251,6 +252,7 @@ help: consider removing the safety comment
|
|||
LL | // SAFETY:
|
||||
| ^^^^^^^^^^
|
||||
= note: `-D clippy::unnecessary-safety-comment` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_safety_comment)]`
|
||||
|
||||
error: unsafe impl missing a safety comment
|
||||
--> $DIR/undocumented_unsafe_blocks.rs:473:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&boxed_slice[1]`
|
||||
|
|
||||
= note: `-D clippy::get-unwrap` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::get_unwrap)]`
|
||||
|
||||
error: used `unwrap()` on an `Option` value
|
||||
--> $DIR/unwrap_used.rs:38:17
|
||||
|
@ -15,6 +16,7 @@ LL | let _ = boxed_slice.get(1).unwrap();
|
|||
= note: if this value is `None`, it will panic
|
||||
= help: consider using `expect()` to provide a better panic message
|
||||
= note: `-D clippy::unwrap-used` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::unwrap_used)]`
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/unwrap_used.rs:39:17
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | struct HTTPResponse; // not linted by default, but with cfg option
|
|||
| ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `HttpResponse`
|
||||
|
|
||||
= note: `-D clippy::upper-case-acronyms` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::upper_case_acronyms)]`
|
||||
|
||||
error: name `NS` contains a capitalized acronym
|
||||
--> $DIR/upper_case_acronyms.rs:8:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | struct Foo(Vec<Box<u8>>);
|
|||
| ^^^^^^^^^^^^ help: try: `Vec<u8>`
|
||||
|
|
||||
= note: `-D clippy::vec-box` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::vec_box)]`
|
||||
|
||||
error: `Vec<T>` is already on the heap, the boxing is unnecessary
|
||||
--> $DIR/test.rs:10:12
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | u <= 0;
|
|||
|
|
||||
= 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`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::absurd_extreme_comparisons)]`
|
||||
|
||||
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:16:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | #[allow(dead_code)]
|
|||
| ^^^^^ help: replace it with: `expect`
|
||||
|
|
||||
= note: `-D clippy::allow-attributes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::allow_attributes)]`
|
||||
|
||||
error: #[allow] attribute found
|
||||
--> $DIR/allow_attributes.rs:22:30
|
||||
|
|
|
@ -7,6 +7,7 @@ LL | let _ = ('a') ..'z';
|
|||
| help: use an inclusive range: `..=`
|
||||
|
|
||||
= note: `-D clippy::almost-complete-range` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
|
||||
|
||||
error: almost complete ascii range
|
||||
--> $DIR/almost_complete_range.rs:19:17
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let my_e = 2.7182;
|
|||
|
|
||||
= help: consider using the constant directly
|
||||
= note: `-D clippy::approx-constant` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::approx_constant)]`
|
||||
|
||||
error: approximate value of `f{32, 64}::consts::E` found
|
||||
--> $DIR/approx_const.rs:6:20
|
||||
|
|
|
@ -8,6 +8,7 @@ LL | let _ = Arc::new(RefCell::new(42));
|
|||
= note: required for `Arc<RefCell<i32>>` to implement `Send` and `Sync`
|
||||
= help: consider using an `Rc` instead or wrapping the inner type with a `Mutex`
|
||||
= note: `-D clippy::arc-with-non-send-sync` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arc_with_non_send_sync)]`
|
||||
|
||||
error: usage of an `Arc` that is not `Send` or `Sync`
|
||||
--> $DIR/arc_with_non_send_sync.rs:40:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | _n += 1;
|
|||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
|
||||
|
||||
error: arithmetic operation that can potentially result in unexpected side-effects
|
||||
--> $DIR/arithmetic_side_effects.rs:305:5
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let i = 0u32 as u64;
|
|||
|
|
||||
= help: consider using a safe wrapper for this conversion
|
||||
= note: `-D clippy::as-conversions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_conversions)]`
|
||||
|
||||
error: using a potentially dangerous silent `as` conversion
|
||||
--> $DIR/as_conversions.rs:12:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = string.as_ptr() as *mut u8;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()`
|
||||
|
|
||||
= note: `-D clippy::as-ptr-cast-mut` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_ptr_cast_mut)]`
|
||||
|
||||
error: casting the result of `as_ptr` to *mut i8
|
||||
--> $DIR/as_ptr_cast_mut.rs:25:22
|
||||
|
|
|
@ -7,6 +7,7 @@ LL | foo(n as _);
|
|||
| help: consider giving the type explicitly: `usize`
|
||||
|
|
||||
= note: `-D clippy::as-underscore` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::as_underscore)]`
|
||||
|
||||
error: using `as _` conversion
|
||||
--> $DIR/as_underscore.rs:10:18
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | asm!("");
|
|||
|
|
||||
= help: use AT&T x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_intel_syntax)]`
|
||||
|
||||
error: Intel x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:10:9
|
||||
|
@ -31,6 +32,7 @@ LL | asm!("", options(att_syntax));
|
|||
|
|
||||
= help: use Intel x86 assembly syntax
|
||||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_att_syntax)]`
|
||||
|
||||
error: AT&T x86 assembly syntax used
|
||||
--> $DIR/asm_syntax.rs:28:9
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | assert!(true);
|
|||
|
|
||||
= help: remove it
|
||||
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assertions_on_constants)]`
|
||||
|
||||
error: `assert!(false)` should probably be replaced
|
||||
--> $DIR/assertions_on_constants.rs:12:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | assert!(r.is_ok());
|
|||
| ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()`
|
||||
|
|
||||
= note: `-D clippy::assertions-on-result-states` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assertions_on_result_states)]`
|
||||
|
||||
error: called `assert!` with `Result::is_ok`
|
||||
--> $DIR/assertions_on_result_states.rs:42:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | a = a + 1;
|
|||
| ^^^^^^^^^ help: replace it with: `a += 1`
|
||||
|
|
||||
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]`
|
||||
|
||||
error: manual implementation of an assign operation
|
||||
--> $DIR/assign_ops.rs:8:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | a += a + 1;
|
|||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::misrefactored_assign_op)]`
|
||||
help: did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
|
||||
|
|
||||
LL | a += 1;
|
||||
|
@ -141,6 +142,7 @@ LL | buf = buf + cows.clone();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
|
||||
|
|
||||
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::assign_op_pattern)]`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ LL | | };
|
|||
| |______- outer async construct
|
||||
|
|
||||
= note: `-D clippy::async-yields-async` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::async_yields_async)]`
|
||||
help: consider awaiting this value
|
||||
|
|
||||
LL ~ async {
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | #[inline(always)]
|
|||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::inline-always` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::inline_always)]`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:27:14
|
||||
|
@ -13,6 +14,7 @@ LL | #[deprecated(since = "forever")]
|
|||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::deprecated-semver` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_semver)]`
|
||||
|
||||
error: the since field must contain a semver-compliant version
|
||||
--> $DIR/attrs.rs:32:14
|
||||
|
|
|
@ -14,6 +14,7 @@ LL | | baz().await
|
|||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]`
|
||||
|
||||
error: this `MutexGuard` is held across an `await` point
|
||||
--> $DIR/await_holding_lock.rs:25:13
|
||||
|
|
|
@ -14,6 +14,7 @@ LL | | baz().await
|
|||
LL | | }
|
||||
| |_^
|
||||
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`
|
||||
|
||||
error: this `RefCell` reference is held across an `await` point
|
||||
--> $DIR/await_holding_refcell_ref.rs:12:9
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | x & 0 == 0;
|
|||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::bad-bit-mask` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bad_bit_mask)]`
|
||||
|
||||
error: this operation will always return zero. This is likely not the intended outcome
|
||||
--> $DIR/bit_masks.rs:14:5
|
||||
|
@ -87,6 +88,7 @@ LL | x | 1 > 3;
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::ineffective-bit-mask` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::ineffective_bit_mask)]`
|
||||
|
||||
error: ineffective bit mask: `x | 1` compared to `4`, is the same as x compared directly
|
||||
--> $DIR/bit_masks.rs:72:5
|
||||
|
|
|
@ -3,6 +3,7 @@ error: `clippy::restriction` is not meant to be enabled as a group
|
|||
= note: because of the command line `--warn clippy::restriction`
|
||||
= help: enable the restriction lints you need individually
|
||||
= note: `-D clippy::blanket-clippy-restriction-lints` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blanket_clippy_restriction_lints)]`
|
||||
|
||||
error: `clippy::restriction` is not meant to be enabled as a group
|
||||
--> $DIR/blanket_clippy_restriction_lints.rs:6:9
|
||||
|
|
|
@ -8,6 +8,7 @@ LL | | } {
|
|||
| |_____^
|
||||
|
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blocks_in_if_conditions)]`
|
||||
help: try
|
||||
|
|
||||
LL ~ let res = {
|
||||
|
@ -29,6 +30,7 @@ LL | if true && x == 3 { 6 } else { 10 }
|
|||
| ^^^^^^^^^^^^^^ help: try: `x == 3`
|
||||
|
|
||||
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ LL | | },
|
|||
| |_____________^
|
||||
|
|
||||
= note: `-D clippy::blocks-in-if-conditions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::blocks_in_if_conditions)]`
|
||||
|
||||
error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
|
||||
--> $DIR/blocks_in_if_conditions_closure.rs:34:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | assert_eq!("a".is_empty(), false);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::bool-assert-comparison` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_assert_comparison)]`
|
||||
help: replace it with `assert!(..)`
|
||||
|
|
||||
LL - assert_eq!("a".is_empty(), false);
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | if x == true {
|
|||
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
||||
|
|
||||
= note: `-D clippy::bool-comparison` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
|
||||
|
||||
error: equality checks against false can be replaced by a negation
|
||||
--> $DIR/bool_comparison.rs:12:8
|
||||
|
|
|
@ -10,6 +10,7 @@ LL | | };
|
|||
|
|
||||
= note: `a as i32` or `a.into()` can also be valid options
|
||||
= note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bool_to_int_with_if)]`
|
||||
|
||||
error: boolean to int conversion using if
|
||||
--> $DIR/bool_to_int_with_if.rs:19:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _p = &val as *const i32;
|
|||
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of!(val)`
|
||||
|
|
||||
= note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`
|
||||
|
||||
error: borrow as raw pointer
|
||||
--> $DIR/borrow_as_ptr.rs:17:18
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _p = &val as *const i32;
|
|||
| ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::addr_of!(val)`
|
||||
|
|
||||
= note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`
|
||||
|
||||
error: borrow as raw pointer
|
||||
--> $DIR/borrow_as_ptr_no_std.rs:11:18
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let b = &*a;
|
|||
| ^^^ help: if you would like to reborrow, try removing `&*`: `a`
|
||||
|
|
||||
= note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]`
|
||||
|
||||
error: deref on an immutable reference
|
||||
--> $DIR/borrow_deref_ref.rs:15:22
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let x: &str = &*s;
|
|||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::borrow-deref-ref` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]`
|
||||
help: if you would like to reborrow, try removing `&*`
|
||||
|
|
||||
LL | let x: &str = s;
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | fn test1(foo: Box<Vec<bool>>) {}
|
|||
|
|
||||
= help: `Vec<..>` is already on the heap, `Box<Vec<..>>` makes an extra allocation
|
||||
= note: `-D clippy::box-collection` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::box_collection)]`
|
||||
|
||||
error: you seem to be trying to use `Box<String>`. Consider using just `String`
|
||||
--> $DIR/box_collection.rs:29:15
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _string: Box<String> = Box::new(Default::default());
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
||||
|
|
||||
= note: `-D clippy::box-default` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::box_default)]`
|
||||
|
||||
error: `Box::new(_)` of default value
|
||||
--> $DIR/box_default.rs:23:17
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | fn warn_arg(x: Box<A>) {
|
|||
| ^
|
||||
|
|
||||
= note: `-D clippy::boxed-local` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::boxed_local)]`
|
||||
|
||||
error: local variable doesn't need to be boxed here
|
||||
--> $DIR/boxed_local.rs:123:12
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | fn foo<u32>(a: u32) -> u32 {
|
|||
| ^^^
|
||||
|
|
||||
= note: `-D clippy::builtin-type-shadow` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::builtin_type_shadow)]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/builtin_type_shadow.rs:5:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = String::from("foo").bytes().count();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.len()` instead: `String::from("foo").len()`
|
||||
|
|
||||
= note: `-D clippy::bytes-count-to-len` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bytes_count_to_len)]`
|
||||
|
||||
error: using long and hard to read `.bytes().count()`
|
||||
--> $DIR/bytes_count_to_len.rs:10:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = s.bytes().nth(3);
|
|||
| ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3).copied()`
|
||||
|
|
||||
= note: `-D clippy::bytes-nth` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::bytes_nth)]`
|
||||
|
||||
error: called `.bytes().nth().unwrap()` on a `String`
|
||||
--> $DIR/bytes_nth.rs:7:14
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | filename.ends_with(".rs")
|
|||
|
|
||||
= help: consider using a case-insensitive comparison instead
|
||||
= note: `-D clippy::case-sensitive-file-extension-comparisons` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::case_sensitive_file_extension_comparisons)]`
|
||||
help: use std::path::Path
|
||||
|
|
||||
LL ~ std::path::Path::new(filename)
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | x0 as f32;
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `i64` to `f32` causes a loss of precision (`i64` is 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
|
||||
--> $DIR/cast.rs:20:5
|
||||
|
@ -44,6 +45,7 @@ LL | 1f32 as i32;
|
|||
|
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
||||
|
||||
error: casting `f32` to `u32` may truncate the value
|
||||
--> $DIR/cast.rs:35:5
|
||||
|
@ -60,6 +62,7 @@ LL | 1f32 as u32;
|
|||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-sign-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_sign_loss)]`
|
||||
|
||||
error: casting `f64` to `f32` may truncate the value
|
||||
--> $DIR/cast.rs:39:5
|
||||
|
@ -190,6 +193,7 @@ LL | 1u8 as i8;
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `u16` to `i16` may wrap around the value
|
||||
--> $DIR/cast.rs:69:5
|
||||
|
@ -360,6 +364,7 @@ LL | let _ = Self::B as u8;
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-enum-truncation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_truncation)]`
|
||||
|
||||
error: casting `main::E5` to `i8` may truncate the value
|
||||
--> $DIR/cast.rs:260:21
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let y: u32 = x.abs() as u32;
|
|||
| ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()`
|
||||
|
|
||||
= note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_abs_to_unsigned)]`
|
||||
|
||||
error: casting the result of `i32::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:10:20
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | (&1u8 as *const u8) as *const u16;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_ptr_alignment)]`
|
||||
|
||||
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) (1 < 2 bytes)
|
||||
--> $DIR/cast_alignment.rs:22:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = Foo::Y as usize;
|
|||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-enum-constructor` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_enum_constructor)]`
|
||||
|
||||
error: cast of an enum tuple constructor to an integer
|
||||
--> $DIR/cast_enum_constructor.rs:16:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = true as u8;
|
|||
| ^^^^^^^^^^ help: try: `u8::from(true)`
|
||||
|
|
||||
= note: `-D clippy::cast-lossless` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
||||
|
||||
error: casting `bool` to `u16` is more cleanly stated with `u16::from(_)`
|
||||
--> $DIR/cast_lossless_bool.rs:7:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = x0 as f32;
|
|||
| ^^^^^^^^^ help: try: `f32::from(x0)`
|
||||
|
|
||||
= note: `-D clippy::cast-lossless` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
||||
|
||||
error: casting `i8` to `f64` may become silently lossy if you later change the type
|
||||
--> $DIR/cast_lossless_float.rs:8:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = 1i8 as i16;
|
|||
| ^^^^^^^^^^ help: try: `i16::from(1i8)`
|
||||
|
|
||||
= note: `-D clippy::cast-lossless` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
|
||||
|
||||
error: casting `i8` to `i32` may become silently lossy if you later change the type
|
||||
--> $DIR/cast_lossless_integer.rs:7:13
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let _ = (0.0_f32 / -0.0) as usize;
|
|||
|
|
||||
= note: this always evaluates to 0
|
||||
= note: `-D clippy::cast-nan-to-int` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_nan_to_int)]`
|
||||
|
||||
error: casting a known NaN to usize
|
||||
--> $DIR/cast_nan_to_int.rs:8:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _: *const [u8] = unsafe { std::slice::from_raw_parts(ptr, 1) as *co
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)`
|
||||
|
|
||||
= note: `-D clippy::cast-slice-from-raw-parts` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_slice_from_raw_parts)]`
|
||||
|
||||
error: casting the result of `from_raw_parts_mut` to *mut [u8]
|
||||
--> $DIR/cast_raw_slice_pointer_cast.rs:9:35
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | 1isize as i8;
|
|||
|
|
||||
= help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
|
||||
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
|
||||
help: ... or use `try_from` and handle the error accordingly
|
||||
|
|
||||
LL | i8::try_from(1isize);
|
||||
|
@ -18,6 +19,7 @@ LL | x0 as f64;
|
|||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-precision-loss` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_precision_loss)]`
|
||||
|
||||
error: casting `usize` to `f64` causes a loss of precision on targets with 64-bit wide pointers (`usize` is 64 bits wide, but `f64`'s mantissa is only 52 bits wide)
|
||||
--> $DIR/cast_size.rs:19:5
|
||||
|
@ -92,6 +94,7 @@ LL | 1usize as i32;
|
|||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cast_possible_wrap)]`
|
||||
|
||||
error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
|
||||
--> $DIR/cast_size.rs:36:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | #[cfg_attr(rustfmt, rustfmt::skip)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `#[rustfmt::skip]`
|
||||
|
|
||||
= note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::deprecated_cfg_attr)]`
|
||||
|
||||
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes
|
||||
--> $DIR/cfg_attr_rustfmt.rs:22:1
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | #[cfg(features = "not-really-a-feature")]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `feature = "not-really-a-feature"`
|
||||
|
|
||||
= note: `-D clippy::maybe-misused-cfg` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::maybe_misused_cfg)]`
|
||||
|
||||
error: feature may misspelled as features
|
||||
--> $DIR/cfg_features.rs:9:34
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let _ = '❤' as u8;
|
|||
|
|
||||
= note: `char` is four bytes wide, but `u8` is a single byte
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::char_lit_as_u8)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ LL | let _ = 'a' as u8;
|
|||
|
|
||||
= note: `char` is four bytes wide, but `u8` is a single byte
|
||||
= note: `-D clippy::char-lit-as-u8` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::char_lit_as_u8)]`
|
||||
|
||||
error: casting a character literal to `u8` truncates
|
||||
--> $DIR/char_lit_as_u8_suggestions.rs:5:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = value <= (u32::max_value() as i64) && value >= 0;
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `u32::try_from(value).is_ok()`
|
||||
|
|
||||
= note: `-D clippy::checked-conversions` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::checked_conversions)]`
|
||||
|
||||
error: checked cast can be simplified
|
||||
--> $DIR/checked_conversions.rs:15:13
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | v.drain(0..v.len());
|
|||
| ^^^^^^^^^^^^^^^^^ help: try: `clear()`
|
||||
|
|
||||
= note: `-D clippy::clear-with-drain` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::clear_with_drain)]`
|
||||
|
||||
error: `drain` used to clear a `Vec`
|
||||
--> $DIR/clear_with_drain.rs:26:7
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | 42.clone();
|
|||
| ^^^^^^^^^^ help: try removing the `clone` call: `42`
|
||||
|
|
||||
= note: `-D clippy::clone-on-copy` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::clone_on_copy)]`
|
||||
|
||||
error: using `clone` on type `i32` which implements the `Copy` trait
|
||||
--> $DIR/clone_on_copy.rs:27:5
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | let _ = [1].iter().cloned();
|
|||
| ^^^^^^ help: try: `copied`
|
||||
|
|
||||
= note: `-D clippy::cloned-instead-of-copied` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cloned_instead_of_copied)]`
|
||||
|
||||
error: used `cloned` where `copied` could be used instead
|
||||
--> $DIR/cloned_instead_of_copied.rs:8:31
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | if p == ptr::null() {
|
|||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::cmp-null` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cmp_null)]`
|
||||
|
||||
error: comparing with null is better expressed by the `.is_null()` method
|
||||
--> $DIR/cmp_null.rs:16:8
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | if borrowed.to_owned() == owned {}
|
|||
| ^^^^^^^^^^^^^^^^^^^ help: try: `borrowed`
|
||||
|
|
||||
= note: `-D clippy::cmp-owned` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/asymmetric_partial_eq.rs:47:21
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | if a.to_string() != "bar" {
|
|||
| ^^^^^^^^^^^^^ help: try: `a`
|
||||
|
|
||||
= note: `-D clippy::cmp-owned` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/comparison_flip.rs:10:17
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | x != "foo".to_string();
|
|||
| ^^^^^^^^^^^^^^^^^ help: try: `"foo"`
|
||||
|
|
||||
= note: `-D clippy::cmp-owned` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::cmp_owned)]`
|
||||
|
||||
error: this creates an owned instance just for comparison
|
||||
--> $DIR/with_suggestion.rs:7:9
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue