clippy::useless_return

This commit is contained in:
Maan2003 2021-06-13 09:35:29 +05:30
parent 75370312fb
commit c50b4579ec
No known key found for this signature in database
GPG Key ID: E9AF024BA63C70ED
10 changed files with 15 additions and 15 deletions

View File

@ -1000,7 +1000,7 @@ impl From<ast::LiteralKind> 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))
{

View File

@ -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) }
}

View File

@ -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
}
}
}

View File

@ -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);

View File

@ -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)
})
}
_ => return None,
_ => None,
}
}

View File

@ -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,
}
}

View File

@ -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))

View File

@ -539,7 +539,7 @@ impl server::Literal for Rustc {
} else {
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 {

View File

@ -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
}
}
}

View File

@ -701,7 +701,7 @@ impl GlobalState {
},
);
return Ok(());
Ok(())
})?
.on::<lsp_types::notification::DidChangeWatchedFiles>(|this, params| {
for change in params.changes {