]> git.proxmox.com Git - rustc.git/blame - src/test/ui/suggestions/copied-and-cloned.fixed
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / suggestions / copied-and-cloned.fixed
CommitLineData
f2b60f7d
FG
1// run-rustfix
2
3fn expect<T>(_: T) {}
4
5fn main() {
6 let x = Some(&());
7 expect::<Option<()>>(x.copied());
8 //~^ ERROR mismatched types
9 //~| HELP use `Option::copied` to copy the value inside the `Option`
10 let x = Ok(&());
11 expect::<Result<(), ()>>(x.copied());
12 //~^ ERROR mismatched types
13 //~| HELP use `Result::copied` to copy the value inside the `Result`
14 let s = String::new();
15 let x = Some(&s);
16 expect::<Option<String>>(x.cloned());
17 //~^ ERROR mismatched types
18 //~| HELP use `Option::cloned` to clone the value inside the `Option`
19 let x = Ok(&s);
20 expect::<Result<String, ()>>(x.cloned());
21 //~^ ERROR mismatched types
22 //~| HELP use `Result::cloned` to clone the value inside the `Result`
23}