]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/inefficient_to_string.fixed
Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errors
[rust.git] / src / tools / clippy / tests / ui / inefficient_to_string.fixed
1 // run-rustfix
2 #![deny(clippy::inefficient_to_string)]
3
4 use std::borrow::Cow;
5
6 fn main() {
7     let rstr: &str = "hello";
8     let rrstr: &&str = &rstr;
9     let rrrstr: &&&str = &rrstr;
10     let _: String = rstr.to_string();
11     let _: String = (*rrstr).to_string();
12     let _: String = (**rrrstr).to_string();
13
14     let string: String = String::from("hello");
15     let rstring: &String = &string;
16     let rrstring: &&String = &rstring;
17     let rrrstring: &&&String = &rrstring;
18     let _: String = string.to_string();
19     let _: String = rstring.to_string();
20     let _: String = (*rrstring).to_string();
21     let _: String = (**rrrstring).to_string();
22
23     let cow: Cow<'_, str> = Cow::Borrowed("hello");
24     let rcow: &Cow<'_, str> = &cow;
25     let rrcow: &&Cow<'_, str> = &rcow;
26     let rrrcow: &&&Cow<'_, str> = &rrcow;
27     let _: String = cow.to_string();
28     let _: String = rcow.to_string();
29     let _: String = (*rrcow).to_string();
30     let _: String = (**rrrcow).to_string();
31 }