Add a lint for not using field pattern shorthands

Closes #17792.
This commit is contained in:
P1start
2014-10-06 13:36:53 +13:00
parent 56d544f7ad
commit ead6c4b9d4
53 changed files with 266 additions and 203 deletions

View File

@@ -1139,10 +1139,12 @@ pub fn noop_fold_pat<T: Folder>(p: P<Pat>, folder: &mut T) -> P<Pat> {
PatStruct(pth, fields, etc) => {
let pth = folder.fold_path(pth);
let fs = fields.move_map(|f| {
ast::FieldPat {
ident: f.ident,
pat: folder.fold_pat(f.pat)
}
Spanned { span: folder.new_span(f.span),
node: ast::FieldPat {
ident: f.node.ident,
pat: folder.fold_pat(f.node.pat),
is_shorthand: f.node.is_shorthand,
}}
});
PatStruct(pth, fs, etc)
}