mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
fix clippy::needless_return
This commit is contained in:
parent
21ffc5350d
commit
77790f2b8e
6 changed files with 14 additions and 17 deletions
|
@ -235,7 +235,7 @@ pub fn eval_const(expr: &Expr, ctx: &mut ConstEvalCtx<'_>) -> Result<ComputedExp
|
|||
Ok(ComputedExpr::Literal(Literal::Int(r, None)))
|
||||
}
|
||||
BinaryOp::LogicOp(_) => Err(ConstEvalError::TypeError),
|
||||
_ => return Err(ConstEvalError::NotSupported("bin op on this operators")),
|
||||
_ => Err(ConstEvalError::NotSupported("bin op on this operators")),
|
||||
}
|
||||
}
|
||||
Expr::Block { statements, tail, .. } => {
|
||||
|
|
|
@ -278,7 +278,7 @@ impl InherentImpls {
|
|||
impls.collect_def_map(db, &crate_def_map);
|
||||
impls.shrink_to_fit();
|
||||
|
||||
return Arc::new(impls);
|
||||
Arc::new(impls)
|
||||
}
|
||||
|
||||
pub(crate) fn inherent_impls_in_block_query(
|
||||
|
@ -291,7 +291,7 @@ impl InherentImpls {
|
|||
impls.shrink_to_fit();
|
||||
return Some(Arc::new(impls));
|
||||
}
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
||||
fn shrink_to_fit(&mut self) {
|
||||
|
|
|
@ -333,7 +333,7 @@ impl Module {
|
|||
}
|
||||
});
|
||||
|
||||
return (refs, adt_fields);
|
||||
(refs, adt_fields)
|
||||
}
|
||||
|
||||
fn expand_and_group_usages_file_wise(
|
||||
|
@ -563,7 +563,7 @@ impl Module {
|
|||
}
|
||||
});
|
||||
}
|
||||
return use_opt;
|
||||
use_opt
|
||||
});
|
||||
|
||||
let mut use_tree_str_opt: Option<Vec<ast::Path>> = None;
|
||||
|
@ -646,7 +646,7 @@ impl Module {
|
|||
return Some(item);
|
||||
}
|
||||
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
||||
fn process_use_stmt_for_import_resolve(
|
||||
|
@ -842,7 +842,7 @@ fn does_source_exists_outside_sel_in_same_mod(
|
|||
_ => {}
|
||||
}
|
||||
|
||||
return source_exists_outside_sel_in_same_mod;
|
||||
source_exists_outside_sel_in_same_mod
|
||||
}
|
||||
|
||||
fn get_replacements_for_visibilty_change(
|
||||
|
@ -890,7 +890,7 @@ fn get_replacements_for_visibilty_change(
|
|||
}
|
||||
});
|
||||
|
||||
return (body_items, replacements, record_field_parents, impls);
|
||||
(body_items, replacements, record_field_parents, impls)
|
||||
}
|
||||
|
||||
fn get_use_tree_paths_from_path(
|
||||
|
@ -943,15 +943,13 @@ fn compare_hir_and_ast_module(
|
|||
return None;
|
||||
}
|
||||
|
||||
return Some(());
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn indent_range_before_given_node(node: &SyntaxNode) -> Option<TextRange> {
|
||||
let x = node.siblings_with_tokens(syntax::Direction::Prev).find(|x| {
|
||||
return x.kind() == WHITESPACE;
|
||||
})?;
|
||||
|
||||
return Some(x.text_range());
|
||||
node.siblings_with_tokens(syntax::Direction::Prev)
|
||||
.find(|x| x.kind() == WHITESPACE)
|
||||
.map(|x| x.text_range())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -46,7 +46,6 @@ pub(crate) fn complete_derive(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
acc.add_resolution(ctx, name, def);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
None if is_absolute_path => acc.add_crate_roots(ctx),
|
||||
// only show modules in a fresh UseTree
|
||||
|
|
|
@ -14,7 +14,7 @@ pub(super) fn complete_repr(acc: &mut Completions, ctx: &CompletionContext, inpu
|
|||
ast::Expr::PathExpr(path) => path.path()?.as_single_name_ref(),
|
||||
ast::Expr::CallExpr(call) => match call.expr()? {
|
||||
ast::Expr::PathExpr(path) => path.path()?.as_single_name_ref(),
|
||||
_ => return None,
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
})
|
||||
|
|
|
@ -167,7 +167,7 @@ impl GlobalState {
|
|||
self.handle_event(event)?
|
||||
}
|
||||
|
||||
return Err("client exited without proper shutdown sequence".into());
|
||||
Err("client exited without proper shutdown sequence".into())
|
||||
}
|
||||
|
||||
fn next_event(&self, inbox: &Receiver<lsp_server::Message>) -> Option<Event> {
|
||||
|
|
Loading…
Reference in a new issue