match child {
// Don't modify `use` items, as this can break the `use` item when injecting a new
// import into the use tree.
- ast::Use(_it) => continue,
+ ast::Use(_) => continue,
// Don't descend into submodules, they don't have the same `use` items in scope.
// FIXME: This isn't true due to `super::*` imports?
- ast::Module(_it) => continue,
+ ast::Module(_) => continue,
ast::Path(p) => if maybe_replace_path(p.clone(), path.clone()).is_none() {
shorten_paths(p.syntax(), path);
},
(ty, name)
},
- ast::ArgList(_it) => {
+ ast::ArgList(_) => {
cov_mark::hit!(expected_type_fn_param);
ActiveParameter::at_token(
&self.sema,
.map(|c| (Some(c.return_type()), None))
.unwrap_or((None, None))
},
- ast::ParamList(__) => (None, None),
- ast::Stmt(__) => (None, None),
- ast::Item(__) => (None, None),
+ ast::ParamList(_) => (None, None),
+ ast::Stmt(_) => (None, None),
+ ast::Item(_) => (None, None),
_ => {
match node.parent() {
Some(n) => {
Some(match_ast! {
match parent {
- ast::LifetimeParam(_it) => LifetimeContext::LifetimeParam(sema.find_node_at_offset_with_macros(original_file, offset)),
- ast::BreakExpr(_it) => LifetimeContext::LabelRef,
- ast::ContinueExpr(_it) => LifetimeContext::LabelRef,
- ast::Label(_it) => LifetimeContext::LabelDef,
+ ast::LifetimeParam(_) => LifetimeContext::LifetimeParam(sema.find_node_at_offset_with_macros(original_file, offset)),
+ ast::BreakExpr(_) => LifetimeContext::LabelRef,
+ ast::ContinueExpr(_) => LifetimeContext::LabelRef,
+ ast::Label(_) => LifetimeContext::LabelDef,
_ => LifetimeContext::Lifetime,
}
})
path_ctx.kind = path.syntax().ancestors().find_map(|it| {
match_ast! {
match it {
- ast::PathType(_it) => Some(PathKind::Type),
+ ast::PathType(_) => Some(PathKind::Type),
ast::PathExpr(it) => {
path_ctx.has_call_parens = it.syntax().parent().map_or(false, |it| ast::CallExpr::can_cast(it.kind()));
Some(PathKind::Expr)
Some(PathKind::Pat)
},
ast::MacroCall(it) => it.excl_token().and(Some(PathKind::Mac)),
- ast::Meta(_it) => Some(PathKind::Attr),
+ ast::Meta(_) => Some(PathKind::Attr),
ast::Visibility(it) => Some(PathKind::Vis { has_in_token: it.in_token().is_some() }),
- ast::UseTree(_it) => Some(PathKind::Use),
+ ast::UseTree(_) => Some(PathKind::Use),
_ => None,
}
}
});
return (PatternRefutability::Irrefutable, param.ty().is_some())
},
- ast::MatchArm(__) => PatternRefutability::Refutable,
- ast::Condition(__) => PatternRefutability::Refutable,
- ast::ForExpr(__) => PatternRefutability::Irrefutable,
+ ast::MatchArm(_) => PatternRefutability::Refutable,
+ ast::Condition(_) => PatternRefutability::Refutable,
+ ast::ForExpr(_) => PatternRefutability::Irrefutable,
_ => PatternRefutability::Irrefutable,
}
};
let res = match_ast! {
match prev_sibling {
// vis followed by random ident will always error the parser
- ast::Visibility(_it) => ImmediatePrevSibling::Visibility,
+ ast::Visibility(_) => ImmediatePrevSibling::Visibility,
_ => return None,
}
};
let node = it.expr().filter(|_| it.semicolon_token().is_none())?.syntax().clone();
match_ast! {
match node {
- ast::IfExpr(_it) => ImmediatePrevSibling::IfExpr,
+ ast::IfExpr(_) => ImmediatePrevSibling::IfExpr,
_ => return None,
}
}
} else {
return None
},
- ast::Attr(_it) => ImmediatePrevSibling::Attribute,
+ ast::Attr(_) => ImmediatePrevSibling::Attribute,
_ => return None,
}
};
let res = match_ast! {
match parent {
- ast::IdentPat(_it) => ImmediateLocation::IdentPat,
- ast::Rename(_it) => ImmediateLocation::Rename,
- ast::StmtList(_it) => ImmediateLocation::StmtList,
- ast::SourceFile(_it) => ImmediateLocation::ItemList,
- ast::ItemList(_it) => ImmediateLocation::ItemList,
- ast::RefExpr(_it) => ImmediateLocation::RefExpr,
- ast::Variant(_it) => ImmediateLocation::Variant,
+ ast::IdentPat(_) => ImmediateLocation::IdentPat,
+ ast::Rename(_) => ImmediateLocation::Rename,
+ ast::StmtList(_) => ImmediateLocation::StmtList,
+ ast::SourceFile(_) => ImmediateLocation::ItemList,
+ ast::ItemList(_) => ImmediateLocation::ItemList,
+ ast::RefExpr(_) => ImmediateLocation::RefExpr,
+ ast::Variant(_) => ImmediateLocation::Variant,
ast::RecordField(it) => if it.ty().map_or(false, |it| it.syntax().text_range().contains(offset)) {
return None;
} else {
ImmediateLocation::RecordField
},
- ast::RecordExprFieldList(_it) => sema
+ ast::RecordExprFieldList(_) => sema
.find_node_at_offset_with_macros(original_file, offset)
.map(ImmediateLocation::RecordExprUpdate)?,
- ast::TupleField(_it) => ImmediateLocation::TupleField,
- ast::TupleFieldList(_it) => ImmediateLocation::TupleField,
- ast::TypeBound(_it) => ImmediateLocation::TypeBound,
- ast::TypeBoundList(_it) => ImmediateLocation::TypeBound,
+ ast::TupleField(_) => ImmediateLocation::TupleField,
+ ast::TupleFieldList(_) => ImmediateLocation::TupleField,
+ ast::TypeBound(_) => ImmediateLocation::TypeBound,
+ ast::TypeBoundList(_) => ImmediateLocation::TypeBound,
ast::AssocItemList(it) => match it.syntax().parent().map(|it| it.kind()) {
Some(IMPL) => ImmediateLocation::Impl,
Some(TRAIT) => ImmediateLocation::Trait,
_ => return None,
},
- ast::GenericArgList(_it) => sema
+ ast::GenericArgList(_) => sema
.find_node_at_offset_with_macros(original_file, offset)
.map(ImmediateLocation::GenericArgList)?,
ast::Module(it) => {
let mode = r.syntax().ancestors().find_map(|node| {
match_ast! {
- match (node) {
+ match node {
ast::BinExpr(expr) => {
if matches!(expr.op_kind()?, ast::BinaryOp::Assignment { .. }) {
// If the variable or field ends on the LHS's end then it's a Write (covers fields and locals).
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
(match ($node:expr) {
- $( ast::$ast:ident($it:ident) => $res:expr, )*
+ $( ast::$ast:ident($it:pat) => $res:expr, )*
_ => $catch_all:expr $(,)?
}) => {{
$( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
return Some(tree_path);
}
},
- ast::UseTreeList(_it) => continue,
+ ast::UseTreeList(_) => continue,
ast::Path(parent) => path = parent,
_ => return None,
}