Skip to content

Commit c50b457

Browse files
committed
clippy::useless_return
1 parent 7537031 commit c50b457

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

crates/hir_def/src/body/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ impl From<ast::LiteralKind> for Literal {
10001000
// FIXME: these should have actual values filled in, but unsure on perf impact
10011001
LiteralKind::IntNumber(lit) => {
10021002
if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) {
1003-
return Literal::Float(Default::default(), builtin);
1003+
Literal::Float(Default::default(), builtin)
10041004
} else if let builtin @ Some(_) =
10051005
lit.suffix().and_then(|it| BuiltinInt::from_suffix(it))
10061006
{

crates/hir_expand/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn parse_macro_expansion(
241241
}
242242
};
243243
if is_self_replicating(&node, &call_node.value) {
244-
return ExpandResult::only_err(err);
244+
ExpandResult::only_err(err)
245245
} else {
246246
ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) }
247247
}

crates/ide/src/doc_links.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub(crate) fn doc_attributes(
192192
ast::TupleField(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Field(def))),
193193
ast::Macro(it) => sema.to_def(&it).map(|def| (def.attrs(sema.db), Definition::Macro(def))),
194194
// ast::Use(it) => sema.to_def(&it).map(|def| (Box::new(it) as _, def.attrs(sema.db))),
195-
_ => return None
195+
_ => None
196196
}
197197
}
198198
}

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ fn highlight_name_ref_by_syntax(
527527

528528
match parent.kind() {
529529
METHOD_CALL_EXPR => {
530-
return ast::MethodCallExpr::cast(parent)
530+
ast::MethodCallExpr::cast(parent)
531531
.and_then(|it| highlight_method_call(sema, krate, &it))
532-
.unwrap_or_else(|| SymbolKind::Function.into());
532+
.unwrap_or_else(|| SymbolKind::Function.into())
533533
}
534534
FIELD_EXPR => {
535535
let h = HlTag::Symbol(SymbolKind::Field);

crates/ide/src/syntax_highlighting/inject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option<ast::Stri
232232
string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text)
233233
})
234234
}
235-
_ => return None,
235+
_ => None,
236236
}
237237
}
238238

crates/ide_assists/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ impl AssistKind {
4747
}
4848

4949
match self {
50-
AssistKind::None | AssistKind::Generate => return true,
50+
AssistKind::None | AssistKind::Generate => true,
5151
AssistKind::Refactor => match other {
5252
AssistKind::RefactorExtract
5353
| AssistKind::RefactorInline
54-
| AssistKind::RefactorRewrite => return true,
55-
_ => return false,
54+
| AssistKind::RefactorRewrite => true,
55+
_ => false,
5656
},
57-
_ => return false,
57+
_ => false,
5858
}
5959
}
6060

crates/proc_macro_api/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl ProcMacroProcessSrv {
7777

7878
match res {
7979
Some(Response::Error(err)) => {
80-
return Err(tt::ExpansionError::ExpansionError(err.message));
80+
Err(tt::ExpansionError::ExpansionError(err.message))
8181
}
8282
Some(res) => Ok(res.try_into().map_err(|err| {
8383
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))

crates/proc_macro_srv/src/rustc_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl server::Literal for Rustc {
539539
} else {
540540
n.parse::<u128>().unwrap().to_string()
541541
};
542-
return Literal { text: n.into(), id: tt::TokenId::unspecified() };
542+
Literal { text: n.into(), id: tt::TokenId::unspecified() }
543543
}
544544

545545
fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal {

crates/rust-analyzer/src/dispatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ impl<'a> RequestDispatcher<'a> {
104104

105105
let res = crate::from_json(R::METHOD, req.params);
106106
match res {
107-
Ok(params) => return Some((req.id, params)),
107+
Ok(params) => Some((req.id, params)),
108108
Err(err) => {
109109
let response = lsp_server::Response::new_err(
110110
req.id,
111111
lsp_server::ErrorCode::InvalidParams as i32,
112112
err.to_string(),
113113
);
114114
self.global_state.respond(response);
115-
return None;
115+
None
116116
}
117117
}
118118
}

crates/rust-analyzer/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ impl GlobalState {
701701
},
702702
);
703703

704-
return Ok(());
704+
Ok(())
705705
})?
706706
.on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| {
707707
for change in params.changes {

0 commit comments

Comments
 (0)