Skip to content

Commit

Permalink
Adjust clippy tests with new rustc help suggestion for lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Sep 4, 2023
1 parent efbe445 commit 9190e96
Show file tree
Hide file tree
Showing 751 changed files with 838 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui-toml/print_macro/print_macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui-toml/semicolon_block/both.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/tests/ui-toml/vec_box_sized/test.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 9190e96

Please sign in to comment.