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/hir_def/src/body/lower.rs | 2 +- crates/hir_expand/src/db.rs | 2 +- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/syntax_highlighting/highlight.rs | 4 ++-- crates/ide/src/syntax_highlighting/inject.rs | 2 +- crates/ide_assists/src/lib.rs | 8 ++++---- crates/proc_macro_api/src/process.rs | 2 +- crates/proc_macro_srv/src/rustc_server.rs | 2 +- crates/rust-analyzer/src/dispatch.rs | 4 ++-- crates/rust-analyzer/src/main_loop.rs | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) (limited to 'crates') 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 for Literal { // FIXME: these should have actual values filled in, but unsure on perf impact LiteralKind::IntNumber(lit) => { if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) { - return Literal::Float(Default::default(), builtin); + Literal::Float(Default::default(), builtin) } else if let builtin @ Some(_) = lit.suffix().and_then(|it| BuiltinInt::from_suffix(it)) { 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( } }; if is_self_replicating(&node, &call_node.value) { - return ExpandResult::only_err(err); + ExpandResult::only_err(err) } else { ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) } } 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( ast::TupleField(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Field(def))), ast::Macro(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Macro(def))), // ast::Use(it) => sema.to_def(&it).map(|def| (Box::new(it) as _, def.attrs(sema.db))), - _ => return None + _ => None } } } 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, } } 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 { } match self { - AssistKind::None | AssistKind::Generate => return true, + AssistKind::None | AssistKind::Generate => true, AssistKind::Refactor => match other { AssistKind::RefactorExtract | AssistKind::RefactorInline - | AssistKind::RefactorRewrite => return true, - _ => return false, + | AssistKind::RefactorRewrite => true, + _ => false, }, - _ => return false, + _ => false, } } 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 { match res { Some(Response::Error(err)) => { - return Err(tt::ExpansionError::ExpansionError(err.message)); + Err(tt::ExpansionError::ExpansionError(err.message)) } Some(res) => Ok(res.try_into().map_err(|err| { 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 { } else { n.parse::().unwrap().to_string() }; - return Literal { text: n.into(), id: tt::TokenId::unspecified() }; + Literal { text: n.into(), id: tt::TokenId::unspecified() } } 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> { let res = crate::from_json(R::METHOD, req.params); match res { - Ok(params) => return Some((req.id, params)), + Ok(params) => Some((req.id, params)), Err(err) => { let response = lsp_server::Response::new_err( req.id, @@ -112,7 +112,7 @@ impl<'a> RequestDispatcher<'a> { err.to_string(), ); self.global_state.respond(response); - return None; + None } } } 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 { }, ); - return Ok(()); + Ok(()) })? .on::(|this, params| { for change in params.changes { -- cgit v1.2.3