rust-lang/rust#148190 caused a regression for the unwrap_or_default lint around the vec! macro. Code like this no longer triggers the lint:
let with_new = Some(vec![1]);
with_new.unwrap_or_else(Vec::new);
Curiously, adding a type annotation to the let brings the lint back (see the clippy test diff of that PR).
We weren't able to fully figure out why this happens, but the best lead was that the change in the vec! macro lowering confused expr_type_is_certain, making it no longer consider the type of with_new to be certain, thus silencing the lint.
rust-lang/rust#148190 caused a regression for the
unwrap_or_defaultlint around thevec!macro. Code like this no longer triggers the lint:Curiously, adding a type annotation to the
letbrings the lint back (see the clippy test diff of that PR).We weren't able to fully figure out why this happens, but the best lead was that the change in the
vec!macro lowering confusedexpr_type_is_certain, making it no longer consider the type ofwith_newto be certain, thus silencing the lint.