aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-20 17:54:57 +0100
committerGitHub <[email protected]>2020-07-20 17:54:57 +0100
commit21b4e9178fd7047f01f6d999abe6b167027263d9 (patch)
tree0fac8c81fa4940e946f6f7f1efe2af2383207b0b
parent7a089a7bab3779ad83719a91f0db6ec6ccf0175b (diff)
parent17f4d27f1285a76961b2e3957dc192de8e4f179f (diff)
Merge #5440
5440: Minor perf tweaks per clippy r=matklad a=kjeremy Co-authored-by: Jeremy Kolb <[email protected]>
-rw-r--r--crates/ra_assists/src/handlers/raw_string.rs2
-rw-r--r--crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs2
-rw-r--r--crates/ra_hir_ty/src/lower.rs2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs4
-rw-r--r--crates/ra_ide/src/diagnostics.rs2
-rw-r--r--crates/ra_ide/src/inlay_hints.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs2
7 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs
index ba1dcb610..4e8a0c2db 100644
--- a/crates/ra_assists/src/handlers/raw_string.rs
+++ b/crates/ra_assists/src/handlers/raw_string.rs
@@ -131,7 +131,7 @@ pub(crate) fn remove_hash(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
131 let token = ctx.find_token_at_offset(RAW_STRING).and_then(ast::RawString::cast)?; 131 let token = ctx.find_token_at_offset(RAW_STRING).and_then(ast::RawString::cast)?;
132 132
133 let text = token.text().as_str(); 133 let text = token.text().as_str();
134 if !text.starts_with("r#") && text.ends_with("#") { 134 if !text.starts_with("r#") && text.ends_with('#') {
135 return None; 135 return None;
136 } 136 }
137 137
diff --git a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
index dfd314abf..3d51faa54 100644
--- a/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
+++ b/crates/ra_assists/src/handlers/replace_qualified_name_with_use.rs
@@ -106,7 +106,7 @@ fn maybe_replace_path(
106 path: ast::Path, 106 path: ast::Path,
107 target: ast::Path, 107 target: ast::Path,
108) -> Option<()> { 108) -> Option<()> {
109 if !path_eq(path.clone(), target.clone()) { 109 if !path_eq(path.clone(), target) {
110 return None; 110 return None;
111 } 111 }
112 112
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs
index f274579ea..1eacc6f95 100644
--- a/crates/ra_hir_ty/src/lower.rs
+++ b/crates/ra_hir_ty/src/lower.rs
@@ -341,7 +341,7 @@ impl Ty {
341 let segment = remaining_segments.first().unwrap(); 341 let segment = remaining_segments.first().unwrap();
342 let found = associated_type_by_name_including_super_traits( 342 let found = associated_type_by_name_including_super_traits(
343 ctx.db, 343 ctx.db,
344 trait_ref.clone(), 344 trait_ref,
345 &segment.name, 345 &segment.name,
346 ); 346 );
347 match found { 347 match found {
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 9e82d6854..c84d43d77 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -215,7 +215,7 @@ impl<'a> CompletionContext<'a> {
215 215
216 fn fill_keyword_patterns(&mut self, file_with_fake_ident: &SyntaxNode, offset: TextSize) { 216 fn fill_keyword_patterns(&mut self, file_with_fake_ident: &SyntaxNode, offset: TextSize) {
217 let fake_ident_token = file_with_fake_ident.token_at_offset(offset).right_biased().unwrap(); 217 let fake_ident_token = file_with_fake_ident.token_at_offset(offset).right_biased().unwrap();
218 let syntax_element = NodeOrToken::Token(fake_ident_token.clone()); 218 let syntax_element = NodeOrToken::Token(fake_ident_token);
219 self.block_expr_parent = has_block_expr_parent(syntax_element.clone()); 219 self.block_expr_parent = has_block_expr_parent(syntax_element.clone());
220 self.unsafe_is_prev = unsafe_is_prev(syntax_element.clone()); 220 self.unsafe_is_prev = unsafe_is_prev(syntax_element.clone());
221 self.if_is_prev = if_is_prev(syntax_element.clone()); 221 self.if_is_prev = if_is_prev(syntax_element.clone());
@@ -228,7 +228,7 @@ impl<'a> CompletionContext<'a> {
228 self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); 228 self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone());
229 self.is_match_arm = is_match_arm(syntax_element.clone()); 229 self.is_match_arm = is_match_arm(syntax_element.clone());
230 self.has_item_list_or_source_file_parent = 230 self.has_item_list_or_source_file_parent =
231 has_item_list_or_source_file_parent(syntax_element.clone()); 231 has_item_list_or_source_file_parent(syntax_element);
232 } 232 }
233 233
234 fn fill( 234 fn fill(
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index fe75f4b2c..e029af0dc 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -183,7 +183,7 @@ fn missing_struct_field_fix(
183 } 183 }
184 new_field = format!("\n{}{}", indent, new_field); 184 new_field = format!("\n{}{}", indent, new_field);
185 185
186 let needs_comma = !last_field_syntax.to_string().ends_with(","); 186 let needs_comma = !last_field_syntax.to_string().ends_with(',');
187 if needs_comma { 187 if needs_comma {
188 new_field = format!(",{}", new_field); 188 new_field = format!(",{}", new_field);
189 } 189 }
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 43a5e29b5..09883ab4d 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -171,7 +171,7 @@ fn get_param_name_hints(
171 .map(|(param_name, arg)| InlayHint { 171 .map(|(param_name, arg)| InlayHint {
172 range: arg.syntax().text_range(), 172 range: arg.syntax().text_range(),
173 kind: InlayKind::ParameterHint, 173 kind: InlayKind::ParameterHint,
174 label: param_name.to_string().into(), 174 label: param_name.into(),
175 }); 175 });
176 176
177 acc.extend(hints); 177 acc.extend(hints);
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 3f4dbdd8c..d7ae00b07 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -242,7 +242,7 @@ impl GlobalState {
242 }) 242 })
243 .map(move |cargo| { 243 .map(move |cargo| {
244 let cargo_project_root = cargo.workspace_root().to_path_buf(); 244 let cargo_project_root = cargo.workspace_root().to_path_buf();
245 FlycheckHandle::spawn(sender, config.clone(), cargo_project_root.into()) 245 FlycheckHandle::spawn(sender, config, cargo_project_root.into())
246 }) 246 })
247 } 247 }
248} 248}