mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Cleanup
This commit is contained in:
parent
4a3a525ea9
commit
0146a95a39
1 changed files with 2 additions and 3 deletions
|
@ -25,9 +25,8 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
|
||||||
let stmt = ctx.find_node_at_offset::<LetStmt>()?;
|
let stmt = ctx.find_node_at_offset::<LetStmt>()?;
|
||||||
let module = ctx.sema.scope(stmt.syntax()).module()?;
|
let module = ctx.sema.scope(stmt.syntax()).module()?;
|
||||||
let expr = stmt.initializer()?;
|
let expr = stmt.initializer()?;
|
||||||
let pat = stmt.pat()?;
|
|
||||||
// Must be a binding
|
// Must be a binding
|
||||||
let pat = match pat {
|
let pat = match stmt.pat()? {
|
||||||
ast::Pat::BindPat(bind_pat) => bind_pat,
|
ast::Pat::BindPat(bind_pat) => bind_pat,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
@ -46,7 +45,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
|
||||||
// Assist not applicable if the type has already been specified
|
// Assist not applicable if the type has already been specified
|
||||||
// and it has no placeholders
|
// and it has no placeholders
|
||||||
let ascribed_ty = stmt.ascribed_type();
|
let ascribed_ty = stmt.ascribed_type();
|
||||||
if let Some(ref ty) = ascribed_ty {
|
if let Some(ty) = &ascribed_ty {
|
||||||
if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() {
|
if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue