diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/no_effect_replace.rs')
| -rw-r--r-- | src/tools/clippy/tests/ui/no_effect_replace.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/no_effect_replace.rs b/src/tools/clippy/tests/ui/no_effect_replace.rs index ad17d53f789..e4fd5caae2a 100644 --- a/src/tools/clippy/tests/ui/no_effect_replace.rs +++ b/src/tools/clippy/tests/ui/no_effect_replace.rs @@ -2,21 +2,30 @@ fn main() { let _ = "12345".replace('1', "1"); + //~^ ERROR: replacing text with itself + //~| NOTE: `-D clippy::no-effect-replace` implied by `-D warnings` let _ = "12345".replace("12", "12"); + //~^ ERROR: replacing text with itself let _ = String::new().replace("12", "12"); + //~^ ERROR: replacing text with itself let _ = "12345".replacen('1', "1", 1); + //~^ ERROR: replacing text with itself let _ = "12345".replacen("12", "12", 1); + //~^ ERROR: replacing text with itself let _ = String::new().replacen("12", "12", 1); + //~^ ERROR: replacing text with itself let _ = "12345".replace("12", "22"); let _ = "12345".replacen("12", "22", 1); let mut x = X::default(); let _ = "hello".replace(&x.f(), &x.f()); + //~^ ERROR: replacing text with itself let _ = "hello".replace(&x.f(), &x.ff()); let _ = "hello".replace(&y(), &y()); + //~^ ERROR: replacing text with itself let _ = "hello".replace(&y(), &z()); let _ = Replaceme.replace("a", "a"); |
