From f9bb398cc50d2cad543cd5d2d135db5574ba3a6c Mon Sep 17 00:00:00 2001 From: kjeremy Date: Tue, 16 Feb 2021 10:55:34 -0500 Subject: Fix a few clippy::perf warnings --- crates/ide/src/references/rename.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ide/src/references') diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 08f16b54d..a4b320227 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs @@ -342,8 +342,10 @@ fn rename_to_self(sema: &Semantics, 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() -- cgit v1.2.3