From d84912483dcdf568d8abd1c11832661758412f00 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 20 Mar 2021 13:44:12 +0100 Subject: Fix add_life_to_type label typo --- crates/ide_assists/src/handlers/add_lifetime_to_type.rs | 5 ++--- crates/ide_assists/src/handlers/add_turbo_fish.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ide_assists/src/handlers') diff --git a/crates/ide_assists/src/handlers/add_lifetime_to_type.rs b/crates/ide_assists/src/handlers/add_lifetime_to_type.rs index 2edf7b204..844928754 100644 --- a/crates/ide_assists/src/handlers/add_lifetime_to_type.rs +++ b/crates/ide_assists/src/handlers/add_lifetime_to_type.rs @@ -29,8 +29,7 @@ pub(crate) fn add_lifetime_to_type(acc: &mut Assists, ctx: &AssistContext) -> Op let node = ctx.find_node_at_offset::()?; let has_lifetime = node .generic_param_list() - .map(|gen_list| gen_list.lifetime_params().count() > 0) - .unwrap_or_default(); + .map_or(false, |gen_list| gen_list.lifetime_params().next().is_some()); if has_lifetime { return None; @@ -41,7 +40,7 @@ pub(crate) fn add_lifetime_to_type(acc: &mut Assists, ctx: &AssistContext) -> Op acc.add( AssistId("add_lifetime_to_type", AssistKind::Generate), - "Add lifetime`", + "Add lifetime", target, |builder| { match node.generic_param_list() { diff --git a/crates/ide_assists/src/handlers/add_turbo_fish.rs b/crates/ide_assists/src/handlers/add_turbo_fish.rs index 436767895..e4bb61c4e 100644 --- a/crates/ide_assists/src/handlers/add_turbo_fish.rs +++ b/crates/ide_assists/src/handlers/add_turbo_fish.rs @@ -26,7 +26,7 @@ use crate::{ pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { let ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| { let arg_list = ctx.find_node_at_offset::()?; - if arg_list.args().count() > 0 { + if arg_list.args().next().is_some() { return None; } cov_mark::hit!(add_turbo_fish_after_call); -- cgit v1.2.3