]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/no_effect_replace.rs
1 #![warn(clippy::no_effect_replace)]
4 let _
= "12345".replace('
1'
, "1");
5 let _
= "12345".replace("12", "12");
6 let _
= String
::new().replace("12", "12");
8 let _
= "12345".replacen('
1'
, "1", 1);
9 let _
= "12345".replacen("12", "12", 1);
10 let _
= String
::new().replacen("12", "12", 1);
12 let _
= "12345".replace("12", "22");
13 let _
= "12345".replacen("12", "22", 1);
15 let mut x
= X
::default();
16 let _
= "hello".replace(&x
.f(), &x
.f());
17 let _
= "hello".replace(&x
.f(), &x
.ff());
19 let _
= "hello".replace(&y(), &y());
20 let _
= "hello".replace(&y(), &z());
22 let _
= Replaceme
.replace("a", "a");
29 fn f(&mut self) -> String
{
33 fn ff(&mut self) -> String
{
48 pub fn replace(&mut self, a
: &str, b
: &str) -> Self {