Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22815 from ada4a/push-mqsknqnotoku
internal: remove manual lifetime extension
| -rw-r--r-- | crates/hir-def/src/nameres/mod_resolution.rs | 8 | ||||
| -rw-r--r-- | crates/hir-def/src/nameres/path_resolution.rs | 13 | ||||
| -rw-r--r-- | crates/ide/src/hover/render.rs | 8 | ||||
| -rw-r--r-- | crates/ide/src/inlay_hints/closing_brace.rs | 9 | ||||
| -rw-r--r-- | xtask/src/install.rs | 6 |
5 files changed, 9 insertions, 35 deletions
diff --git a/crates/hir-def/src/nameres/mod_resolution.rs b/crates/hir-def/src/nameres/mod_resolution.rs index af7bd818f4..2f337a6ac8 100644 --- a/crates/hir-def/src/nameres/mod_resolution.rs +++ b/crates/hir-def/src/nameres/mod_resolution.rs @@ -149,13 +149,7 @@ impl DirPath { if attr.starts_with("./") { attr = &attr["./".len()..]; } - let tmp; - let attr = if attr.contains('\\') { - tmp = attr.replace('\\', "/"); - &tmp - } else { - attr - }; + let attr = if attr.contains('\\') { &attr.replace('\\', "/") } else { attr }; let res = format!("{base}{attr}"); res } diff --git a/crates/hir-def/src/nameres/path_resolution.rs b/crates/hir-def/src/nameres/path_resolution.rs index 7ffac38086..fde1db4734 100644 --- a/crates/hir-def/src/nameres/path_resolution.rs +++ b/crates/hir-def/src/nameres/path_resolution.rs @@ -504,12 +504,10 @@ impl DefMap { ); } - let def_map; let module_data = if module.block(db) == self.block_id() { &self[module] } else { - def_map = module.def_map(db); - &def_map[module] + &module.def_map(db)[module] }; // Since it is a qualified path here, it should not contains legacy macros @@ -753,14 +751,7 @@ impl DefMap { fn resolve_in_prelude(&self, db: &dyn SourceDatabase, name: &Name) -> PerNs { if let Some((prelude, _use)) = self.prelude { - let keep; - let def_map = if prelude.krate(db) == self.krate { - self - } else { - // Extend lifetime - keep = prelude.def_map(db); - keep - }; + let def_map = if prelude.krate(db) == self.krate { self } else { prelude.def_map(db) }; def_map[prelude].scope.get(name) } else { PerNs::none() diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs index 2067008bb8..78e25b9f39 100644 --- a/crates/ide/src/hover/render.rs +++ b/crates/ide/src/hover/render.rs @@ -326,13 +326,7 @@ pub(super) fn try_for_lint(attr: &ast::Attr, token: &SyntaxToken) -> Option<Hove _ => return None, }; - let tmp; - let needle = if is_clippy { - tmp = format!("clippy::{}", token.text()); - &tmp - } else { - token.text() - }; + let needle = if is_clippy { &format!("clippy::{}", token.text()) } else { token.text() }; let lint = lints.binary_search_by_key(&needle, |lint| lint.label).ok().map(|idx| &lints[idx])?; diff --git a/crates/ide/src/inlay_hints/closing_brace.rs b/crates/ide/src/inlay_hints/closing_brace.rs index c6c8806ac9..836ebfbcf7 100644 --- a/crates/ide/src/inlay_hints/closing_brace.rs +++ b/crates/ide/src/inlay_hints/closing_brace.rs @@ -75,18 +75,17 @@ pub(super) fn hints( node = node.parent()?; let parent = label.syntax().parent()?; - let block; - match_ast! { + let block = match_ast! { match parent { ast::BlockExpr(block_expr) => { - block = block_expr.stmt_list()?; + block_expr.stmt_list()? }, ast::AnyHasLoopBody(loop_expr) => { - block = loop_expr.loop_body()?.stmt_list()?; + loop_expr.loop_body()?.stmt_list()? }, _ => return None, } - } + }; closing_token = block.r_curly_token()?; let lifetime = label.lifetime()?.to_string(); diff --git a/xtask/src/install.rs b/xtask/src/install.rs index bbb6d9aeac..53617c6563 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -108,12 +108,8 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> { }; // Find the appropriate VS Code binary. - let lifetime_extender; let candidates: &[&str] = match client_opt.code_bin.as_deref() { - Some(it) => { - lifetime_extender = [it]; - &lifetime_extender[..] - } + Some(it) => &[it], None => VS_CODES, }; let code = candidates |