},
PatKind::Struct(_, ref fields, _) => {
for pat in fields {
- bindings_impl(cx, &pat.node.pat, map);
+ bindings_impl(cx, &pat.pat, map);
}
},
PatKind::Tuple(ref fields, _) => {
impl EarlyLintPass for DbgMacro {
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
- if mac.node.path == sym!(dbg) {
- if let Some(sugg) = tts_span(mac.node.tts.clone()).and_then(|span| snippet_opt(cx, span)) {
+ if mac.path == sym!(dbg) {
+ if let Some(sugg) = tts_span(mac.tts.clone()).and_then(|span| snippet_opt(cx, span)) {
span_lint_and_sugg(
cx,
DBG_MACRO,
.name;
for field in pfields {
- if let PatKind::Wild = field.node.pat.node {
+ if let PatKind::Wild = field.pat.node {
wilds += 1;
}
}
let mut normal = vec![];
for field in pfields {
- match field.node.pat.node {
+ match field.pat.node {
PatKind::Wild => {},
_ => {
if let Ok(n) = cx.sess().source_map().span_to_snippet(field.span) {
}
}
for field in pfields {
- if let PatKind::Wild = field.node.pat.node {
+ if let PatKind::Wild = field.pat.node {
wilds -= 1;
if wilds > 0 {
span_lint(
PatKind::Ident(_, ident, _) => self.check_ident(ident),
PatKind::Struct(_, ref fields, _) => {
for field in fields {
- if !field.node.is_shorthand {
- self.visit_pat(&field.node.pat);
+ if !field.is_shorthand {
+ self.visit_pat(&field.pat);
}
}
},
if let Some(init_struct) = init {
if let ExprKind::Struct(_, ref efields, _) = init_struct.node {
for field in pfields {
- let name = field.node.ident.name;
+ let name = field.ident.name;
let efield = efields
.iter()
.find_map(|f| if f.ident.name == name { Some(&*f.expr) } else { None });
- check_pat(cx, &field.node.pat, efield, span, bindings);
+ check_pat(cx, &field.pat, efield, span, bindings);
}
} else {
for field in pfields {
- check_pat(cx, &field.node.pat, init, span, bindings);
+ check_pat(cx, &field.pat, init, span, bindings);
}
}
} else {
for field in pfields {
- check_pat(cx, &field.node.pat, None, span, bindings);
+ check_pat(cx, &field.pat, None, span, bindings);
}
}
},
println!("{}ignore leftover fields: {}", ind, ignore);
println!("{}fields:", ind);
for field in fields {
- println!("{} field name: {}", ind, field.node.ident.name);
- if field.node.is_shorthand {
+ println!("{} field name: {}", ind, field.ident.name);
+ if field.is_shorthand {
println!("{} in shorthand notation", ind);
}
- print_pat(cx, &field.node.pat, indent + 1);
+ print_pat(cx, &field.pat, indent + 1);
}
},
hir::PatKind::TupleStruct(ref path, ref fields, opt_dots_position) => {
if is_enum_variant(cx, qpath, pat.hir_id) {
true
} else {
- are_refutable(cx, fields.iter().map(|field| &*field.node.pat))
+ are_refutable(cx, fields.iter().map(|field| &*field.pat))
}
},
PatKind::TupleStruct(ref qpath, ref pats, _) => {
impl EarlyLintPass for Write {
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
- if mac.node.path == sym!(println) {
+ if mac.path == sym!(println) {
span_lint(cx, PRINT_STDOUT, mac.span, "use of `println!`");
- if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, false) {
+ if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
if fmt_str.contents.is_empty() {
span_lint_and_sugg(
cx,
);
}
}
- } else if mac.node.path == sym!(print) {
+ } else if mac.path == sym!(print) {
span_lint(cx, PRINT_STDOUT, mac.span, "use of `print!`");
- if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, false) {
+ if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
if check_newlines(&fmt_str) {
span_lint_and_then(
cx,
err.multipart_suggestion(
"use `println!` instead",
vec![
- (mac.node.path.span, String::from("println")),
+ (mac.path.span, String::from("println")),
(fmt_str.newline_span(), String::new()),
],
Applicability::MachineApplicable,
);
}
}
- } else if mac.node.path == sym!(write) {
- if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, true) {
+ } else if mac.path == sym!(write) {
+ if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, true) {
if check_newlines(&fmt_str) {
span_lint_and_then(
cx,
err.multipart_suggestion(
"use `writeln!()` instead",
vec![
- (mac.node.path.span, String::from("writeln")),
+ (mac.path.span, String::from("writeln")),
(fmt_str.newline_span(), String::new()),
],
Applicability::MachineApplicable,
)
}
}
- } else if mac.node.path == sym!(writeln) {
- if let (Some(fmt_str), expr) = check_tts(cx, &mac.node.tts, true) {
+ } else if mac.path == sym!(writeln) {
+ if let (Some(fmt_str), expr) = check_tts(cx, &mac.tts, true) {
if fmt_str.contents.is_empty() {
let mut applicability = Applicability::MachineApplicable;
let suggestion = expr.map_or_else(