From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../method-access-to-range-literal-typo.fixed | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/ui/suggestions/method-access-to-range-literal-typo.fixed (limited to 'tests/ui/suggestions/method-access-to-range-literal-typo.fixed') diff --git a/tests/ui/suggestions/method-access-to-range-literal-typo.fixed b/tests/ui/suggestions/method-access-to-range-literal-typo.fixed new file mode 100644 index 000000000..13601eef6 --- /dev/null +++ b/tests/ui/suggestions/method-access-to-range-literal-typo.fixed @@ -0,0 +1,34 @@ +// run-rustfix + +#![allow(unused)] + +fn as_ref() -> Option> { + None +} +struct Type { + option: Option> +} +trait Trait { + fn foo(&self) -> &Vec; +} +impl Trait for Option> { + fn foo(&self) -> &Vec { + self.as_ref().unwrap() + } +} + +impl Type { + fn method(&self) -> Option<&Vec> { + self.option.as_ref().map(|x| x) + //~^ ERROR E0308 + } + fn method2(&self) -> Option<&u8> { + self.option.foo().get(0) + //~^ ERROR E0425 + //~| ERROR E0308 + } +} + +fn main() { + let _ = Type { option: None }.method(); +} -- cgit v1.2.3