Fix add_life_to_type label typo

This commit is contained in:
Lukas Wirth 2021-03-20 13:44:12 +01:00
parent dc8e2fea98
commit d84912483d
2 changed files with 3 additions and 4 deletions

View File

@ -29,8 +29,7 @@ pub(crate) fn add_lifetime_to_type(acc: &mut Assists, ctx: &AssistContext) -> Op
let node = ctx.find_node_at_offset::<ast::Adt>()?; let node = ctx.find_node_at_offset::<ast::Adt>()?;
let has_lifetime = node let has_lifetime = node
.generic_param_list() .generic_param_list()
.map(|gen_list| gen_list.lifetime_params().count() > 0) .map_or(false, |gen_list| gen_list.lifetime_params().next().is_some());
.unwrap_or_default();
if has_lifetime { if has_lifetime {
return None; return None;
@ -41,7 +40,7 @@ pub(crate) fn add_lifetime_to_type(acc: &mut Assists, ctx: &AssistContext) -> Op
acc.add( acc.add(
AssistId("add_lifetime_to_type", AssistKind::Generate), AssistId("add_lifetime_to_type", AssistKind::Generate),
"Add lifetime`", "Add lifetime",
target, target,
|builder| { |builder| {
match node.generic_param_list() { match node.generic_param_list() {

View File

@ -26,7 +26,7 @@
pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 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 ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| {
let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?; let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?;
if arg_list.args().count() > 0 { if arg_list.args().next().is_some() {
return None; return None;
} }
cov_mark::hit!(add_turbo_fish_after_call); cov_mark::hit!(add_turbo_fish_after_call);