From 246f239d9f40f633160f0c18f87a20922d4e77bb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:37 +0200 Subject: Merging debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- src/test/ui/suggestions/copied-and-cloned.fixed | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/ui/suggestions/copied-and-cloned.fixed (limited to 'src/test/ui/suggestions/copied-and-cloned.fixed') diff --git a/src/test/ui/suggestions/copied-and-cloned.fixed b/src/test/ui/suggestions/copied-and-cloned.fixed new file mode 100644 index 000000000..f801403fe --- /dev/null +++ b/src/test/ui/suggestions/copied-and-cloned.fixed @@ -0,0 +1,23 @@ +// run-rustfix + +fn expect(_: T) {} + +fn main() { + let x = Some(&()); + expect::>(x.copied()); + //~^ ERROR mismatched types + //~| HELP use `Option::copied` to copy the value inside the `Option` + let x = Ok(&()); + expect::>(x.copied()); + //~^ ERROR mismatched types + //~| HELP use `Result::copied` to copy the value inside the `Result` + let s = String::new(); + let x = Some(&s); + expect::>(x.cloned()); + //~^ ERROR mismatched types + //~| HELP use `Option::cloned` to clone the value inside the `Option` + let x = Ok(&s); + expect::>(x.cloned()); + //~^ ERROR mismatched types + //~| HELP use `Result::cloned` to clone the value inside the `Result` +} -- cgit v1.2.3