manual_map

This commit is contained in:
Johann Hemmann 2024-01-19 14:06:12 +01:00
parent 60dda08266
commit d8ad4afce8
3 changed files with 2 additions and 9 deletions

View file

@ -182,7 +182,6 @@ get_first = "allow"
if_same_then_else = "allow"
large_enum_variant = "allow"
let_and_return = "allow"
manual_map = "allow"
map_clone = "allow"
match_like_matches_macro = "allow"
match_single_binding = "allow"

View file

@ -410,11 +410,7 @@ impl ConstRef {
lower_ctx: &LowerCtx<'_>,
param: &ast::ConstParam,
) -> Option<Self> {
let default = param.default_val();
match default {
Some(_) => Some(Self::from_const_arg(lower_ctx, default)),
None => None,
}
param.default_val().map(|default| Self::from_const_arg(lower_ctx, Some(default)))
}
pub fn display<'a>(&'a self, db: &'a dyn ExpandDatabase) -> impl fmt::Display + 'a {

View file

@ -4285,10 +4285,8 @@ impl Type {
// arg can be either a `Ty` or `constant`
if let Some(ty) = arg.ty(Interner) {
Some(format_smolstr!("{}", ty.display(db)))
} else if let Some(const_) = arg.constant(Interner) {
Some(format_smolstr!("{}", const_.display(db)))
} else {
None
arg.constant(Interner).map(|const_| format_smolstr!("{}", const_.display(db)))
}
})
}