mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
remove unnecessary lazy evaluations
This commit is contained in:
parent
7530d76f00
commit
cc80c5bd07
31 changed files with 50 additions and 51 deletions
|
@ -1559,7 +1559,7 @@ impl Function {
|
|||
}
|
||||
|
||||
pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> {
|
||||
self.has_self_param(db).then(|| SelfParam { func: self.id })
|
||||
self.has_self_param(db).then_some(SelfParam { func: self.id })
|
||||
}
|
||||
|
||||
pub fn assoc_fn_params(self, db: &dyn HirDatabase) -> Vec<Param> {
|
||||
|
|
|
@ -795,7 +795,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
// requeue the tokens we got from mapping our current token down
|
||||
stack.extend(mapped_tokens);
|
||||
// if the length changed we have found a mapping for the token
|
||||
(stack.len() != len).then(|| ())
|
||||
(stack.len() != len).then_some(())
|
||||
};
|
||||
|
||||
// Remap the next token in the queue into a macro call its in, if it is not being remapped
|
||||
|
@ -1221,7 +1221,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
krate
|
||||
.dependencies(self.db)
|
||||
.into_iter()
|
||||
.find_map(|dep| (dep.name == name).then(|| dep.krate))
|
||||
.find_map(|dep| (dep.name == name).then_some(dep.krate))
|
||||
}
|
||||
|
||||
fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option<VariantId> {
|
||||
|
|
|
@ -987,7 +987,7 @@ fn resolve_hir_path_(
|
|||
db,
|
||||
def,
|
||||
res.in_type_ns()?,
|
||||
|name, id| (name == unresolved.name).then(|| id),
|
||||
|name, id| (name == unresolved.name).then_some(id),
|
||||
)
|
||||
})
|
||||
.map(TypeAlias::from)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue