//@ 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(); }