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 18, 2024
1 parent a9193f2 commit d720088
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 63 deletions.
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
48 changes: 24 additions & 24 deletions tests/ui/regex.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: trivial regex
--> tests/ui/regex.rs:19:45
--> tests/ui/regex.rs:20:45
|
LL | let pipe_in_wrong_position = Regex::new("|");
| ^^^
Expand All @@ -9,15 +9,15 @@ LL | let pipe_in_wrong_position = Regex::new("|");
= help: to override `-D warnings` add `#[allow(clippy::trivial_regex)]`

error: trivial regex
--> tests/ui/regex.rs:21:60
--> tests/ui/regex.rs:22:60
|
LL | let pipe_in_wrong_position_builder = RegexBuilder::new("|");
| ^^^
|
= help: the regex is unlikely to be useful as it is

error: regex syntax error: invalid character class range, the start must be <= the end
--> tests/ui/regex.rs:23:42
--> tests/ui/regex.rs:24:42
|
LL | let wrong_char_ranice = Regex::new("[z-a]");
| ^^^
Expand All @@ -26,7 +26,7 @@ LL | let wrong_char_ranice = Regex::new("[z-a]");
= help: to override `-D warnings` add `#[allow(clippy::invalid_regex)]`

error: regex syntax error: invalid character class range, the start must be <= the end
--> tests/ui/regex.rs:26:37
--> tests/ui/regex.rs:27:37
|
LL | let some_unicode = Regex::new("[é-è]");
| ^^^
Expand All @@ -35,13 +35,13 @@ error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:29:33
--> tests/ui/regex.rs:30:33
|
LL | let some_regex = Regex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^

error: trivial regex
--> tests/ui/regex.rs:31:53
--> tests/ui/regex.rs:32:53
|
LL | let binary_pipe_in_wrong_position = BRegex::new("|");
| ^^^
Expand All @@ -52,7 +52,7 @@ error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:33:41
--> tests/ui/regex.rs:34:41
|
LL | let some_binary_regex = BRegex::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
Expand All @@ -61,7 +61,7 @@ error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:34:56
--> tests/ui/regex.rs:35:56
|
LL | let some_binary_regex_builder = BRegexBuilder::new(OPENING_PAREN);
| ^^^^^^^^^^^^^
Expand All @@ -70,7 +70,7 @@ error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:46:37
--> tests/ui/regex.rs:47:37
|
LL | let set_error = RegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
| ^^^^^^^^^^^^^
Expand All @@ -79,7 +79,7 @@ error: regex parse error:
(
^
error: unclosed group
--> tests/ui/regex.rs:47:39
--> tests/ui/regex.rs:48:39
|
LL | let bset_error = BRegexSet::new(&[OPENING_PAREN, r"[a-z]+\.(com|org|net)"]);
| ^^^^^^^^^^^^^
Expand All @@ -88,107 +88,107 @@ error: regex parse error:
\b\c
^^
error: unrecognized escape sequence
--> tests/ui/regex.rs:54:42
--> tests/ui/regex.rs:55:42
|
LL | let escaped_string_span = Regex::new("\\b\\c");
| ^^^^^^^^
|
= help: consider using a raw string literal: `r".."`

error: regex syntax error: duplicate flag
--> tests/ui/regex.rs:56:34
--> tests/ui/regex.rs:57:34
|
LL | let aux_span = Regex::new("(?ixi)");
| ^ ^

error: regex syntax error: pattern can match invalid UTF-8
--> tests/ui/regex.rs:62:53
--> tests/ui/regex.rs:63:53
|
LL | let invalid_utf8_should_lint = Regex::new("(?-u).");
| ^

error: trivial regex
--> tests/ui/regex.rs:67:33
--> tests/ui/regex.rs:68:33
|
LL | let trivial_eq = Regex::new("^foobar$");
| ^^^^^^^^^^
|
= help: consider using `==` on `str`s

error: trivial regex
--> tests/ui/regex.rs:70:48
--> tests/ui/regex.rs:71:48
|
LL | let trivial_eq_builder = RegexBuilder::new("^foobar$");
| ^^^^^^^^^^
|
= help: consider using `==` on `str`s

error: trivial regex
--> tests/ui/regex.rs:73:42
--> tests/ui/regex.rs:74:42
|
LL | let trivial_starts_with = Regex::new("^foobar");
| ^^^^^^^^^
|
= help: consider using `str::starts_with`

error: trivial regex
--> tests/ui/regex.rs:76:40
--> tests/ui/regex.rs:77:40
|
LL | let trivial_ends_with = Regex::new("foobar$");
| ^^^^^^^^^
|
= help: consider using `str::ends_with`

error: trivial regex
--> tests/ui/regex.rs:79:39
--> tests/ui/regex.rs:80:39
|
LL | let trivial_contains = Regex::new("foobar");
| ^^^^^^^^
|
= help: consider using `str::contains`

error: trivial regex
--> tests/ui/regex.rs:82:39
--> tests/ui/regex.rs:83:39
|
LL | let trivial_contains = Regex::new(NOT_A_REAL_REGEX);
| ^^^^^^^^^^^^^^^^
|
= help: consider using `str::contains`

error: trivial regex
--> tests/ui/regex.rs:85:40
--> tests/ui/regex.rs:86:40
|
LL | let trivial_backslash = Regex::new("a\\.b");
| ^^^^^^^
|
= help: consider using `str::contains`

error: trivial regex
--> tests/ui/regex.rs:89:36
--> tests/ui/regex.rs:90:36
|
LL | let trivial_empty = Regex::new("");
| ^^
|
= help: the regex is unlikely to be useful as it is

error: trivial regex
--> tests/ui/regex.rs:92:36
--> tests/ui/regex.rs:93:36
|
LL | let trivial_empty = Regex::new("^");
| ^^^
|
= help: the regex is unlikely to be useful as it is

error: trivial regex
--> tests/ui/regex.rs:95:36
--> tests/ui/regex.rs:96:36
|
LL | let trivial_empty = Regex::new("^$");
| ^^^^
|
= help: consider using `str::is_empty`

error: trivial regex
--> tests/ui/regex.rs:98:44
--> tests/ui/regex.rs:99:44
|
LL | let binary_trivial_empty = BRegex::new("^$");
| ^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_char_lifetime_names.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::single_char_lifetime_names)]
#![allow(clippy::let_unit_value)]
#![allow(clippy::let_unit_value, clippy::literal_string_with_formatting_arg)]

// Lifetimes should only be linted when they're introduced
struct DiagnosticCtx<'a, 'b>
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_component_path_imports.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]
#![allow(unused_imports, clippy::literal_string_with_formatting_arg)]

use core;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_component_path_imports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]
#![allow(unused_imports, clippy::literal_string_with_formatting_arg)]

use core;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_component_path_imports_nested_first.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]
#![allow(unused_imports, clippy::literal_string_with_formatting_arg)]
//@no-rustfix
use regex;
//~^ ERROR: this import is redundant
Expand Down
Loading

0 comments on commit d720088

Please sign in to comment.