Skip to content

Commit

Permalink
Update new failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 19, 2024
1 parent 62afec7 commit c662397
Show file tree
Hide file tree
Showing 23 changed files with 90 additions and 79 deletions.
1 change: 1 addition & 0 deletions tests/ui-toml/large_include_file/large_include_file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(clippy::large_include_file)]
#![allow(clippy::literal_string_with_formatting_arg)]

// Good
const GOOD_INCLUDE_BYTES: &[u8; 581] = include_bytes!("large_include_file.rs");
Expand Down
23 changes: 7 additions & 16 deletions tests/ui-toml/large_include_file/large_include_file.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
error: attempted to include a large file
--> tests/ui-toml/large_include_file/large_include_file.rs:13:43
error[E0308]: mismatched types
--> tests/ui-toml/large_include_file/large_include_file.rs:5:40
|
LL | const TOO_BIG_INCLUDE_BYTES: &[u8; 654] = include_bytes!("too_big.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | const GOOD_INCLUDE_BYTES: &[u8; 581] = include_bytes!("large_include_file.rs");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 581 elements, found one with 635 elements
|
= 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
--> tests/ui-toml/large_include_file/large_include_file.rs:14:35
|
LL | const TOO_BIG_INCLUDE_STR: &str = include_str!("too_big.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the configuration allows a maximum size of 600 bytes

error: aborting due to 2 previous errors
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.
1 change: 1 addition & 0 deletions tests/ui/auxiliary/proc_macro_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(incomplete_features)]
#![allow(clippy::field_reassign_with_default)]
#![allow(clippy::eq_op)]
#![allow(clippy::literal_string_with_formatting_arg)]

extern crate proc_macro;

Expand Down
3 changes: 2 additions & 1 deletion tests/ui/format.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
clippy::needless_borrow,
clippy::uninlined_format_args,
clippy::needless_raw_string_hashes,
clippy::useless_vec
clippy::useless_vec,
clippy::literal_string_with_formatting_arg
)]

struct Foo(pub String);
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
clippy::needless_borrow,
clippy::uninlined_format_args,
clippy::needless_raw_string_hashes,
clippy::useless_vec
clippy::useless_vec,
clippy::literal_string_with_formatting_arg
)]

struct Foo(pub String);
Expand Down
30 changes: 15 additions & 15 deletions tests/ui/format.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: useless use of `format!`
--> tests/ui/format.rs:19:5
--> tests/ui/format.rs:20:5
|
LL | format!("foo");
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
Expand All @@ -8,19 +8,19 @@ LL | format!("foo");
= help: to override `-D warnings` add `#[allow(clippy::useless_format)]`

error: useless use of `format!`
--> tests/ui/format.rs:20:5
--> tests/ui/format.rs:21:5
|
LL | format!("{{}}");
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:21:5
--> tests/ui/format.rs:22:5
|
LL | format!("{{}} abc {{}}");
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:22:5
--> tests/ui/format.rs:23:5
|
LL | / format!(
LL | | r##"foo {{}}
Expand All @@ -35,67 +35,67 @@ LL ~ " bar"##.to_string();
|

error: useless use of `format!`
--> tests/ui/format.rs:27:13
--> tests/ui/format.rs:28:13
|
LL | let _ = format!("");
| ^^^^^^^^^^^ help: consider using `String::new()`: `String::new()`

error: useless use of `format!`
--> tests/ui/format.rs:29:5
--> tests/ui/format.rs:30:5
|
LL | format!("{}", "foo");
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:37:5
--> tests/ui/format.rs:38:5
|
LL | format!("{}", arg);
| ^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:67:5
--> tests/ui/format.rs:68:5
|
LL | format!("{}", 42.to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:69:5
--> tests/ui/format.rs:70:5
|
LL | format!("{}", x.display().to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:73:18
--> tests/ui/format.rs:74:18
|
LL | let _ = Some(format!("{}", a + "bar"));
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a + "bar"`

error: useless use of `format!`
--> tests/ui/format.rs:77:22
--> tests/ui/format.rs:78:22
|
LL | let _s: String = format!("{}", &*v.join("\n"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("\n")).to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:83:13
--> tests/ui/format.rs:84:13
|
LL | let _ = format!("{x}");
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:85:13
--> tests/ui/format.rs:86:13
|
LL | let _ = format!("{y}", y = x);
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:89:13
--> tests/ui/format.rs:90:13
|
LL | let _ = format!("{abc}");
| ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `abc.to_string()`

error: useless use of `format!`
--> tests/ui/format.rs:91:13
--> tests/ui/format.rs:92:13
|
LL | let _ = format!("{xx}");
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `xx.to_string()`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/print_literal.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::print_literal)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::uninlined_format_args, clippy::literal_string_with_formatting_arg)]

fn main() {
// these should be fine
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/print_literal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::print_literal)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::uninlined_format_args, clippy::literal_string_with_formatting_arg)]

fn main() {
// these should be fine
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
clippy::needless_raw_strings,
clippy::needless_raw_string_hashes,
clippy::needless_borrow,
clippy::needless_borrows_for_generic_args
clippy::needless_borrows_for_generic_args,
clippy::literal_string_with_formatting_arg
)]
#![warn(clippy::invalid_regex, clippy::trivial_regex)]

Expand Down
Loading

0 comments on commit c662397

Please sign in to comment.