diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-20 12:58:28 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-20 12:58:28 +0000 |
commit | 5cc8ad0c4afda0c8b6222156b0c725cfb61892c0 (patch) | |
tree | bdbf2a58f34499392256ae4ed4171d201869e197 /crates/ide_assists | |
parent | 4d67032bbb3e1f97ee7af43cb6f056d01f791ca2 (diff) | |
parent | a9a7c5cb1f76f6d446e24a6867d404a62e60d8e2 (diff) |
Merge #8119
8119: Don't return a SourceChange on WillRenameFiles when nothing gets refactored r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/add_lifetime_to_type.rs | 5 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/add_turbo_fish.rs | 2 |
2 files changed, 3 insertions, 4 deletions
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 | |||
29 | let node = ctx.find_node_at_offset::<ast::Adt>()?; | 29 | let node = ctx.find_node_at_offset::<ast::Adt>()?; |
30 | let has_lifetime = node | 30 | let has_lifetime = node |
31 | .generic_param_list() | 31 | .generic_param_list() |
32 | .map(|gen_list| gen_list.lifetime_params().count() > 0) | 32 | .map_or(false, |gen_list| gen_list.lifetime_params().next().is_some()); |
33 | .unwrap_or_default(); | ||
34 | 33 | ||
35 | if has_lifetime { | 34 | if has_lifetime { |
36 | return None; | 35 | return None; |
@@ -41,7 +40,7 @@ pub(crate) fn add_lifetime_to_type(acc: &mut Assists, ctx: &AssistContext) -> Op | |||
41 | 40 | ||
42 | acc.add( | 41 | acc.add( |
43 | AssistId("add_lifetime_to_type", AssistKind::Generate), | 42 | AssistId("add_lifetime_to_type", AssistKind::Generate), |
44 | "Add lifetime`", | 43 | "Add lifetime", |
45 | target, | 44 | target, |
46 | |builder| { | 45 | |builder| { |
47 | match node.generic_param_list() { | 46 | 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::{ | |||
26 | pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 26 | pub(crate) fn add_turbo_fish(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
27 | let ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| { | 27 | let ident = ctx.find_token_syntax_at_offset(SyntaxKind::IDENT).or_else(|| { |
28 | let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?; | 28 | let arg_list = ctx.find_node_at_offset::<ast::ArgList>()?; |
29 | if arg_list.args().count() > 0 { | 29 | if arg_list.args().next().is_some() { |
30 | return None; | 30 | return None; |
31 | } | 31 | } |
32 | cov_mark::hit!(add_turbo_fish_after_call); | 32 | cov_mark::hit!(add_turbo_fish_after_call); |