mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
clippy::useless_return
This commit is contained in:
parent
75370312fb
commit
c50b4579ec
10 changed files with 15 additions and 15 deletions
|
@ -1000,7 +1000,7 @@ impl From<ast::LiteralKind> for Literal {
|
||||||
// FIXME: these should have actual values filled in, but unsure on perf impact
|
// FIXME: these should have actual values filled in, but unsure on perf impact
|
||||||
LiteralKind::IntNumber(lit) => {
|
LiteralKind::IntNumber(lit) => {
|
||||||
if let builtin @ Some(_) = lit.suffix().and_then(BuiltinFloat::from_suffix) {
|
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(_) =
|
} else if let builtin @ Some(_) =
|
||||||
lit.suffix().and_then(|it| BuiltinInt::from_suffix(it))
|
lit.suffix().and_then(|it| BuiltinInt::from_suffix(it))
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,7 +241,7 @@ fn parse_macro_expansion(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if is_self_replicating(&node, &call_node.value) {
|
if is_self_replicating(&node, &call_node.value) {
|
||||||
return ExpandResult::only_err(err);
|
ExpandResult::only_err(err)
|
||||||
} else {
|
} else {
|
||||||
ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) }
|
ExpandResult { value: Some((parse, Arc::new(rev_token_map))), err: Some(err) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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::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::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))),
|
// ast::Use(it) => sema.to_def(&it).map(|def| (Box::new(it) as _, def.attrs(sema.db))),
|
||||||
_ => return None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,9 +527,9 @@ fn highlight_name_ref_by_syntax(
|
||||||
|
|
||||||
match parent.kind() {
|
match parent.kind() {
|
||||||
METHOD_CALL_EXPR => {
|
METHOD_CALL_EXPR => {
|
||||||
return ast::MethodCallExpr::cast(parent)
|
ast::MethodCallExpr::cast(parent)
|
||||||
.and_then(|it| highlight_method_call(sema, krate, &it))
|
.and_then(|it| highlight_method_call(sema, krate, &it))
|
||||||
.unwrap_or_else(|| SymbolKind::Function.into());
|
.unwrap_or_else(|| SymbolKind::Function.into())
|
||||||
}
|
}
|
||||||
FIELD_EXPR => {
|
FIELD_EXPR => {
|
||||||
let h = HlTag::Symbol(SymbolKind::Field);
|
let h = HlTag::Symbol(SymbolKind::Field);
|
||||||
|
|
|
@ -232,7 +232,7 @@ fn find_doc_string_in_attr(attr: &hir::Attr, it: &ast::Attr) -> Option<ast::Stri
|
||||||
string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text)
|
string.text().get(1..string.text().len() - 1).map_or(false, |it| it == text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => return None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,14 @@ impl AssistKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
AssistKind::None | AssistKind::Generate => return true,
|
AssistKind::None | AssistKind::Generate => true,
|
||||||
AssistKind::Refactor => match other {
|
AssistKind::Refactor => match other {
|
||||||
AssistKind::RefactorExtract
|
AssistKind::RefactorExtract
|
||||||
| AssistKind::RefactorInline
|
| AssistKind::RefactorInline
|
||||||
| AssistKind::RefactorRewrite => return true,
|
| AssistKind::RefactorRewrite => true,
|
||||||
_ => return false,
|
_ => false,
|
||||||
},
|
},
|
||||||
_ => return false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl ProcMacroProcessSrv {
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Some(Response::Error(err)) => {
|
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| {
|
Some(res) => Ok(res.try_into().map_err(|err| {
|
||||||
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
|
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
|
||||||
|
|
|
@ -539,7 +539,7 @@ impl server::Literal for Rustc {
|
||||||
} else {
|
} else {
|
||||||
n.parse::<u128>().unwrap().to_string()
|
n.parse::<u128>().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 {
|
fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal {
|
||||||
|
|
|
@ -104,7 +104,7 @@ impl<'a> RequestDispatcher<'a> {
|
||||||
|
|
||||||
let res = crate::from_json(R::METHOD, req.params);
|
let res = crate::from_json(R::METHOD, req.params);
|
||||||
match res {
|
match res {
|
||||||
Ok(params) => return Some((req.id, params)),
|
Ok(params) => Some((req.id, params)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let response = lsp_server::Response::new_err(
|
let response = lsp_server::Response::new_err(
|
||||||
req.id,
|
req.id,
|
||||||
|
@ -112,7 +112,7 @@ impl<'a> RequestDispatcher<'a> {
|
||||||
err.to_string(),
|
err.to_string(),
|
||||||
);
|
);
|
||||||
self.global_state.respond(response);
|
self.global_state.respond(response);
|
||||||
return None;
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,7 +701,7 @@ impl GlobalState {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return Ok(());
|
Ok(())
|
||||||
})?
|
})?
|
||||||
.on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| {
|
.on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| {
|
||||||
for change in params.changes {
|
for change in params.changes {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue