diff options
author | Maan2003 <[email protected]> | 2021-06-13 05:05:29 +0100 |
---|---|---|
committer | Maan2003 <[email protected]> | 2021-06-13 05:05:29 +0100 |
commit | c50b4579ec842ac7c1f52e0e3c834d50fc9cd1bb (patch) | |
tree | e70b18936d014aa3038c4a6283e200f0a479aeb1 | |
parent | 75370312fbfe072947ffdc568eebc9cb4c6108e4 (diff) |
clippy::useless_return
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/db.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/doc_links.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/inject.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 2 | ||||
-rw-r--r-- | crates/proc_macro_srv/src/rustc_server.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/dispatch.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index a8bd36a0a..bed4c4994 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -1000,7 +1000,7 @@ impl From<ast::LiteralKind> for Literal { | |||
1000 | // FIXME: these should have actual values filled in, but unsure on perf impact | 1000 | // FIXME: these should have actual values filled in, but unsure on perf impact |
1001 | LiteralKind::IntNumber(lit) => { | 1001 | LiteralKind::IntNumber(lit) => { |
1002 | if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) { | 1002 | if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) { |
1003 | return Literal::Float(Default::default(), builtin); | 1003 | Literal::Float(Default::default(), builtin) |
1004 | } else if let builtin @ Some(_) = | 1004 | } else if let builtin @ Some(_) = |
1005 | lit.suffix().and_then(|it| BuiltinInt::from_suffix(it)) | 1005 | lit.suffix().and_then(|it| BuiltinInt::from_suffix(it)) |
1006 | { | 1006 | { |
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 4aecf4af5..66f44202b 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs | |||
@@ -241,7 +241,7 @@ fn parse_macro_expansion( | |||
241 | } | 241 | } |
242 | }; | 242 | }; |
243 | if is_self_replicating(&node, &call_node.value) { | 243 | if is_self_replicating(&node, &call_node.value) { |
244 | return ExpandResult::only_err(err); | 244 | ExpandResult::only_err(err) |
245 | } else { | 245 | } else { |
246 | ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) } | 246 | ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) } |
247 | } | 247 | } |
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 774952d96..57ae9455b 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -192,7 +192,7 @@ pub(crate) fn doc_attributes( | |||
192 | ast::TupleField(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Field(def))), | 192 | ast::TupleField(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Field(def))), |
193 | ast::Macro(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Macro(def))), | 193 | ast::Macro(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Macro(def))), |
194 | // ast::Use(it) => sema.to_def(&it).map(|def| (Box::new(it) as _, def.attrs(sema.db))), | 194 | // ast::Use(it) => sema.to_def(&it).map(|def| (Box::new(it) as _, def.attrs(sema.db))), |
195 | _ => return None | 195 | _ => None |
196 | } | 196 | } |
197 | } | 197 | } |
198 | } | 198 | } |
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( | |||
527 | 527 | ||
528 | match parent.kind() { | 528 | match parent.kind() { |
529 | METHOD_CALL_EXPR => { | 529 | METHOD_CALL_EXPR => { |
530 | return ast::MethodCallExpr::cast(parent) | 530 | ast::MethodCallExpr::cast(parent) |
531 | .and_then(|it| highlight_method_call(sema, krate, &it)) | 531 | .and_then(|it| highlight_method_call(sema, krate, &it)) |
532 | .unwrap_or_else(|| SymbolKind::Function.into()); | 532 | .unwrap_or_else(|| SymbolKind::Function.into()) |
533 | } | 533 | } |
534 | FIELD_EXPR => { | 534 | FIELD_EXPR => { |
535 | let h = HlTag::Symbol(SymbolKind::Field); | 535 | 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<ast::Stri | |||
232 | string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text) | 232 | string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text) |
233 | }) | 233 | }) |
234 | } | 234 | } |
235 | _ => return None, | 235 | _ => None, |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
diff --git a/crates/ide_assists/src/lib.rs b/crates/ide_assists/src/lib.rs index 16af72927..331a6df2b 100644 --- a/crates/ide_assists/src/lib.rs +++ b/crates/ide_assists/src/lib.rs | |||
@@ -47,14 +47,14 @@ impl AssistKind { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | match self { | 49 | match self { |
50 | AssistKind::None | AssistKind::Generate => return true, | 50 | AssistKind::None | AssistKind::Generate => true, |
51 | AssistKind::Refactor => match other { | 51 | AssistKind::Refactor => match other { |
52 | AssistKind::RefactorExtract | 52 | AssistKind::RefactorExtract |
53 | | AssistKind::RefactorInline | 53 | | AssistKind::RefactorInline |
54 | | AssistKind::RefactorRewrite => return true, | 54 | | AssistKind::RefactorRewrite => true, |
55 | _ => return false, | 55 | _ => false, |
56 | }, | 56 | }, |
57 | _ => return false, | 57 | _ => false, |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index 99d05aef3..a9e43be62 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs | |||
@@ -77,7 +77,7 @@ impl ProcMacroProcessSrv { | |||
77 | 77 | ||
78 | match res { | 78 | match res { |
79 | Some(Response::Error(err)) => { | 79 | Some(Response::Error(err)) => { |
80 | return Err(tt::ExpansionError::ExpansionError(err.message)); | 80 | Err(tt::ExpansionError::ExpansionError(err.message)) |
81 | } | 81 | } |
82 | Some(res) => Ok(res.try_into().map_err(|err| { | 82 | Some(res) => Ok(res.try_into().map_err(|err| { |
83 | tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) | 83 | tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) |
diff --git a/crates/proc_macro_srv/src/rustc_server.rs b/crates/proc_macro_srv/src/rustc_server.rs index 5d765f6e2..077b95ac8 100644 --- a/crates/proc_macro_srv/src/rustc_server.rs +++ b/crates/proc_macro_srv/src/rustc_server.rs | |||
@@ -539,7 +539,7 @@ impl server::Literal for Rustc { | |||
539 | } else { | 539 | } else { |
540 | n.parse::<u128>().unwrap().to_string() | 540 | n.parse::<u128>().unwrap().to_string() |
541 | }; | 541 | }; |
542 | return Literal { text: n.into(), id: tt::TokenId::unspecified() }; | 542 | Literal { text: n.into(), id: tt::TokenId::unspecified() } |
543 | } | 543 | } |
544 | 544 | ||
545 | fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal { | 545 | fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal { |
diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs index 2011a4132..5991e72b5 100644 --- a/crates/rust-analyzer/src/dispatch.rs +++ b/crates/rust-analyzer/src/dispatch.rs | |||
@@ -104,7 +104,7 @@ impl<'a> RequestDispatcher<'a> { | |||
104 | 104 | ||
105 | let res = crate::from_json(R::METHOD, req.params); | 105 | let res = crate::from_json(R::METHOD, req.params); |
106 | match res { | 106 | match res { |
107 | Ok(params) => return Some((req.id, params)), | 107 | Ok(params) => Some((req.id, params)), |
108 | Err(err) => { | 108 | Err(err) => { |
109 | let response = lsp_server::Response::new_err( | 109 | let response = lsp_server::Response::new_err( |
110 | req.id, | 110 | req.id, |
@@ -112,7 +112,7 @@ impl<'a> RequestDispatcher<'a> { | |||
112 | err.to_string(), | 112 | err.to_string(), |
113 | ); | 113 | ); |
114 | self.global_state.respond(response); | 114 | self.global_state.respond(response); |
115 | return None; | 115 | None |
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index fa5fc6fbf..1417d8379 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -701,7 +701,7 @@ impl GlobalState { | |||
701 | }, | 701 | }, |
702 | ); | 702 | ); |
703 | 703 | ||
704 | return Ok(()); | 704 | Ok(()) |
705 | })? | 705 | })? |
706 | .on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| { | 706 | .on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| { |
707 | for change in params.changes { | 707 | for change in params.changes { |