mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
s/PatKind::Ident/PatKind::Binding/g
This commit is contained in:
parent
762aff2519
commit
6aa37e57a2
10 changed files with 15 additions and 15 deletions
|
@ -34,7 +34,7 @@ impl LintPass for BlackListedName {
|
|||
|
||||
impl LateLintPass for BlackListedName {
|
||||
fn check_pat(&mut self, cx: &LateContext, pat: &Pat) {
|
||||
if let PatKind::Ident(_, ref ident, _) = pat.node {
|
||||
if let PatKind::Binding(_, ref ident, _) = pat.node {
|
||||
if self.blacklist.iter().any(|s| s == &*ident.node.as_str()) {
|
||||
span_lint(cx,
|
||||
BLACKLISTED_NAME,
|
||||
|
|
|
@ -192,7 +192,7 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<Interned
|
|||
bindings_impl(cx, pat, map);
|
||||
}
|
||||
}
|
||||
PatKind::Ident(_, ref ident, ref as_pat) => {
|
||||
PatKind::Binding(_, ref ident, ref as_pat) => {
|
||||
if let Entry::Vacant(v) = map.entry(ident.node.as_str()) {
|
||||
v.insert(cx.tcx.pat_ty(pat));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
|
|||
_ => (),
|
||||
}
|
||||
for (ref a1, ref a2) in decl.inputs.iter().zip(args) {
|
||||
if let PatKind::Ident(_, ident, _) = a1.pat.node {
|
||||
if let PatKind::Binding(_, ident, _) = a1.pat.node {
|
||||
// XXXManishearth Should I be checking the binding mode here?
|
||||
if let ExprPath(None, ref p) = a2.node {
|
||||
if p.segments.len() != 1 {
|
||||
|
|
|
@ -330,7 +330,7 @@ fn check_for_loop(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, expr: &E
|
|||
fn check_for_loop_range(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Expr, expr: &Expr) {
|
||||
if let Some(UnsugaredRange { start: Some(ref start), ref end, .. }) = unsugar_range(arg) {
|
||||
// the var must be a single name
|
||||
if let PatKind::Ident(_, ref ident, _) = pat.node {
|
||||
if let PatKind::Binding(_, ref ident, _) = pat.node {
|
||||
let mut visitor = VarVisitor {
|
||||
cx: cx,
|
||||
var: ident.node,
|
||||
|
@ -613,7 +613,7 @@ fn check_for_loop_over_map_kv(cx: &LateContext, pat: &Pat, arg: &Expr, body: &Ex
|
|||
fn pat_is_wild(pat: &PatKind, body: &Expr) -> bool {
|
||||
match *pat {
|
||||
PatKind::Wild => true,
|
||||
PatKind::Ident(_, ident, None) if ident.node.as_str().starts_with('_') => {
|
||||
PatKind::Binding(_, ident, None) if ident.node.as_str().starts_with('_') => {
|
||||
let mut visitor = UsedVisitor {
|
||||
var: ident.node,
|
||||
used: false,
|
||||
|
@ -884,7 +884,7 @@ impl<'v, 't> Visitor<'v> for InitializeVisitor<'v, 't> {
|
|||
// Look for declarations of the variable
|
||||
if let DeclLocal(ref local) = decl.node {
|
||||
if local.pat.id == self.var_id {
|
||||
if let PatKind::Ident(_, ref ident, _) = local.pat.node {
|
||||
if let PatKind::Binding(_, ref ident, _) = local.pat.node {
|
||||
self.name = Some(ident.node);
|
||||
|
||||
self.state = if let Some(ref init) = local.init {
|
||||
|
|
|
@ -108,7 +108,7 @@ fn get_type_name(cx: &LateContext, expr: &Expr, arg: &Expr) -> Option<&'static s
|
|||
|
||||
fn get_arg_name(pat: &Pat) -> Option<ast::Name> {
|
||||
match pat.node {
|
||||
PatKind::Ident(_, name, None) => Some(name.node),
|
||||
PatKind::Binding(_, name, None) => Some(name.node),
|
||||
PatKind::Ref(ref subpat, _) => get_arg_name(subpat),
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ fn check_single_match_opt_like(cx: &LateContext, ex: &Expr, arms: &[Arm], expr:
|
|||
}
|
||||
path.to_string()
|
||||
}
|
||||
PatKind::Ident(BindByValue(MutImmutable), ident, None) => ident.node.to_string(),
|
||||
PatKind::Binding(BindByValue(MutImmutable), ident, None) => ident.node.to_string(),
|
||||
_ => return,
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ impl LateLintPass for TopLevelRefPass {
|
|||
return;
|
||||
}
|
||||
for ref arg in &decl.inputs {
|
||||
if let PatKind::Ident(BindByRef(_), _, _) = arg.pat.node {
|
||||
if let PatKind::Binding(BindByRef(_), _, _) = arg.pat.node {
|
||||
span_lint(cx,
|
||||
TOPLEVEL_REF_ARG,
|
||||
arg.pat.span,
|
||||
|
@ -58,7 +58,7 @@ impl LateLintPass for TopLevelRefPass {
|
|||
[
|
||||
let StmtDecl(ref d, _) = s.node,
|
||||
let DeclLocal(ref l) = d.node,
|
||||
let PatKind::Ident(BindByRef(_), i, None) = l.pat.node,
|
||||
let PatKind::Binding(BindByRef(_), i, None) = l.pat.node,
|
||||
let Some(ref init) = l.init
|
||||
], {
|
||||
let tyopt = if let Some(ref ty) = l.ty {
|
||||
|
@ -346,7 +346,7 @@ impl LintPass for PatternPass {
|
|||
|
||||
impl LateLintPass for PatternPass {
|
||||
fn check_pat(&mut self, cx: &LateContext, pat: &Pat) {
|
||||
if let PatKind::Ident(_, ref ident, Some(ref right)) = pat.node {
|
||||
if let PatKind::Binding(_, ref ident, Some(ref right)) = pat.node {
|
||||
if right.node == PatKind::Wild {
|
||||
span_lint(cx,
|
||||
REDUNDANT_PATTERN,
|
||||
|
|
|
@ -65,7 +65,7 @@ impl LateLintPass for ShadowPass {
|
|||
fn check_fn(cx: &LateContext, decl: &FnDecl, block: &Block) {
|
||||
let mut bindings = Vec::new();
|
||||
for arg in &decl.inputs {
|
||||
if let PatKind::Ident(_, ident, _) = arg.pat.node {
|
||||
if let PatKind::Binding(_, ident, _) = arg.pat.node {
|
||||
bindings.push((ident.node.unhygienize(), ident.span))
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ fn is_binding(cx: &LateContext, pat: &Pat) -> bool {
|
|||
fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span, bindings: &mut Vec<(Name, Span)>) {
|
||||
// TODO: match more stuff / destructuring
|
||||
match pat.node {
|
||||
PatKind::Ident(_, ref ident, ref inner) => {
|
||||
PatKind::Binding(_, ref ident, ref inner) => {
|
||||
let name = ident.node.unhygienize();
|
||||
if is_binding(cx, pat) {
|
||||
let mut new_binding = true;
|
||||
|
|
|
@ -63,7 +63,7 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
|
|||
let StmtDecl(ref tmp, _) = w[0].node,
|
||||
let DeclLocal(ref tmp) = tmp.node,
|
||||
let Some(ref tmp_init) = tmp.init,
|
||||
let PatKind::Ident(_, ref tmp_name, None) = tmp.pat.node,
|
||||
let PatKind::Binding(_, ref tmp_name, None) = tmp.pat.node,
|
||||
|
||||
// foo() = bar();
|
||||
let StmtSemi(ref first, _) = w[1].node,
|
||||
|
|
|
@ -145,7 +145,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
|||
(&PatKind::TupleStruct(ref lp, ref la, ls), &PatKind::TupleStruct(ref rp, ref ra, rs)) => {
|
||||
self.eq_path(lp, rp) && over(la, ra, |l, r| self.eq_pat(l, r)) && ls == rs
|
||||
}
|
||||
(&PatKind::Ident(ref lb, ref li, ref lp), &PatKind::Ident(ref rb, ref ri, ref rp)) => {
|
||||
(&PatKind::Binding(ref lb, ref li, ref lp), &PatKind::Binding(ref rb, ref ri, ref rp)) => {
|
||||
lb == rb && li.node.as_str() == ri.node.as_str() && both(lp, rp, |l, r| self.eq_pat(l, r))
|
||||
}
|
||||
(&PatKind::Lit(ref l), &PatKind::Lit(ref r)) => self.eq_expr(l, r),
|
||||
|
|
Loading…
Reference in a new issue