Fix a few clippy::perf warnings

This commit is contained in:
kjeremy
2021-02-16 10:55:34 -05:00
parent cc49502ab4
commit f9bb398cc5
8 changed files with 14 additions and 12 deletions

View File

@@ -342,8 +342,10 @@ fn rename_to_self(sema: &Semantics<RootDatabase>, local: hir::Local) -> RenameRe
// FIXME: reimplement this on the hir instead
// as of the time of this writing params in hir don't keep their names
let fn_ast =
fn_def.source(sema.db).ok_or(format_err!("Cannot rename non-param local to self"))?.value;
let fn_ast = fn_def
.source(sema.db)
.ok_or_else(|| format_err!("Cannot rename non-param local to self"))?
.value;
let first_param_range = fn_ast
.param_list()