From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/ide/src/syntax_highlighting/highlight.rs | 4 ++-- crates/ide/src/syntax_highlighting/html.rs | 2 +- crates/ide/src/syntax_highlighting/inject.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ide/src/syntax_highlighting') diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 84012227d..8c0e553c0 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -449,12 +449,12 @@ fn highlight_method_call( krate: Option, method_call: &ast::MethodCallExpr, ) -> Option { - let func = sema.resolve_method_call(&method_call)?; + let func = sema.resolve_method_call(method_call)?; let mut h = SymbolKind::Function.into(); h |= HlMod::Associated; - if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(&method_call) { + if func.is_unsafe(sema.db) || sema.is_unsafe_method_call(method_call) { h |= HlMod::Unsafe; } if func.is_async(sema.db) { diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index 5327af845..478facfee 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs @@ -23,7 +23,7 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo let hl_ranges = highlight(db, file_id, None, false); let text = parse.tree().syntax().to_string(); let mut buf = String::new(); - buf.push_str(&STYLE); + buf.push_str(STYLE); buf.push_str("
");
     for r in &hl_ranges {
         let chunk = html_escape(&text[r.range]);
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs
index 4269d339e..883252c0e 100644
--- a/crates/ide/src/syntax_highlighting/inject.rs
+++ b/crates/ide/src/syntax_highlighting/inject.rs
@@ -23,7 +23,7 @@ pub(super) fn ra_fixture(
     literal: ast::String,
     expanded: SyntaxToken,
 ) -> Option<()> {
-    let active_parameter = ActiveParameter::at_token(&sema, expanded)?;
+    let active_parameter = ActiveParameter::at_token(sema, expanded)?;
     if !active_parameter.ident().map_or(false, |name| name.text().starts_with("ra_fixture")) {
         return None;
     }
@@ -124,7 +124,7 @@ pub(super) fn doc_comment(
     }
 
     for attr in attributes.by_key("doc").attrs() {
-        let InFile { file_id, value: src } = attrs_source_map.source_of(&attr);
+        let InFile { file_id, value: src } = attrs_source_map.source_of(attr);
         if file_id != node.file_id {
             continue;
         }
-- 
cgit v1.2.3


From c50b4579ec842ac7c1f52e0e3c834d50fc9cd1bb Mon Sep 17 00:00:00 2001
From: Maan2003 
Date: Sun, 13 Jun 2021 09:35:29 +0530
Subject: clippy::useless_return

---
 crates/ide/src/syntax_highlighting/highlight.rs | 4 ++--
 crates/ide/src/syntax_highlighting/inject.rs    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'crates/ide/src/syntax_highlighting')

diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index 8c0e553c0..e2cec21bc 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -527,9 +527,9 @@ fn highlight_name_ref_by_syntax(
 
     match parent.kind() {
         METHOD_CALL_EXPR => {
-            return ast::MethodCallExpr::cast(parent)
+            ast::MethodCallExpr::cast(parent)
                 .and_then(|it| highlight_method_call(sema, krate, &it))
-                .unwrap_or_else(|| SymbolKind::Function.into());
+                .unwrap_or_else(|| SymbolKind::Function.into())
         }
         FIELD_EXPR => {
             let h = HlTag::Symbol(SymbolKind::Field);
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs
index 883252c0e..ec43c8579 100644
--- a/crates/ide/src/syntax_highlighting/inject.rs
+++ b/crates/ide/src/syntax_highlighting/inject.rs
@@ -232,7 +232,7 @@ fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option return None,
+        _ => None,
     }
 }
 
-- 
cgit v1.2.3


From 5ac6804bb3a07b959e8c2c3534255a8d6bb4948c Mon Sep 17 00:00:00 2001
From: Maan2003 
Date: Sun, 13 Jun 2021 09:48:15 +0530
Subject: cargo fmt

---
 crates/ide/src/syntax_highlighting/highlight.rs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'crates/ide/src/syntax_highlighting')

diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs
index e2cec21bc..7a53268e8 100644
--- a/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/crates/ide/src/syntax_highlighting/highlight.rs
@@ -526,11 +526,9 @@ fn highlight_name_ref_by_syntax(
     };
 
     match parent.kind() {
-        METHOD_CALL_EXPR => {
-            ast::MethodCallExpr::cast(parent)
-                .and_then(|it| highlight_method_call(sema, krate, &it))
-                .unwrap_or_else(|| SymbolKind::Function.into())
-        }
+        METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent)
+            .and_then(|it| highlight_method_call(sema, krate, &it))
+            .unwrap_or_else(|| SymbolKind::Function.into()),
         FIELD_EXPR => {
             let h = HlTag::Symbol(SymbolKind::Field);
             let is_union = ast::FieldExpr::cast(parent)
-- 
cgit v1.2.3