Skip to content

Commit 91f057d

Browse files
authored
Auto merge of #36203 - petrochenkov:uvsdot, r=nrc
Replace `_, _` with `..` in patterns This is how #33627 looks in action. Looks especially nice in leftmost/rightmost positions `(first, ..)`/`(.., last)`. I haven't touched libsyntax intentionally because the feature is still unstable.
2 parents 9cc430d + e05e74a commit 91f057d

File tree

128 files changed

+392
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+392
-374
lines changed

src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl OptGroup {
279279
}],
280280
}
281281
}
282-
(_, _) => panic!("something is wrong with the long-form opt"),
282+
_ => panic!("something is wrong with the long-form opt"),
283283
}
284284
}
285285
}

src/librustc/cfg/construct.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
9999

100100
fn pat(&mut self, pat: &hir::Pat, pred: CFGIndex) -> CFGIndex {
101101
match pat.node {
102-
PatKind::Binding(_, _, None) |
102+
PatKind::Binding(.., None) |
103103
PatKind::Path(..) |
104104
PatKind::Lit(..) |
105105
PatKind::Range(..) |
@@ -109,7 +109,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
109109

110110
PatKind::Box(ref subpat) |
111111
PatKind::Ref(ref subpat, _) |
112-
PatKind::Binding(_, _, Some(ref subpat)) => {
112+
PatKind::Binding(.., Some(ref subpat)) => {
113113
let subpat_exit = self.pat(&subpat, pred);
114114
self.add_ast_node(pat.id, &[subpat_exit])
115115
}
@@ -306,7 +306,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
306306
self.call(expr, pred, &func, args.iter().map(|e| &**e))
307307
}
308308

309-
hir::ExprMethodCall(_, _, ref args) => {
309+
hir::ExprMethodCall(.., ref args) => {
310310
self.call(expr, pred, &args[0], args[1..].iter().map(|e| &**e))
311311
}
312312

src/librustc/hir/def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl Def {
104104
pub fn var_id(&self) -> ast::NodeId {
105105
match *self {
106106
Def::Local(_, id) |
107-
Def::Upvar(_, id, _, _) => {
107+
Def::Upvar(_, id, ..) => {
108108
id
109109
}
110110

@@ -124,7 +124,7 @@ impl Def {
124124
Def::Variant(_, id) | Def::Enum(id) | Def::TyAlias(id) | Def::AssociatedTy(_, id) |
125125
Def::TyParam(id) | Def::Struct(id) | Def::Union(id) | Def::Trait(id) |
126126
Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) |
127-
Def::Local(id, _) | Def::Upvar(id, _, _, _) => {
127+
Def::Local(id, _) | Def::Upvar(id, ..) => {
128128
id
129129
}
130130

src/librustc/hir/intravisit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ pub enum FnKind<'a> {
4949
impl<'a> FnKind<'a> {
5050
pub fn attrs(&self) -> &'a [Attribute] {
5151
match *self {
52-
FnKind::ItemFn(_, _, _, _, _, _, attrs) => attrs,
53-
FnKind::Method(_, _, _, attrs) => attrs,
52+
FnKind::ItemFn(.., attrs) => attrs,
53+
FnKind::Method(.., attrs) => attrs,
5454
FnKind::Closure(attrs) => attrs,
5555
}
5656
}
@@ -341,7 +341,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
341341
visitor.visit_id(item.id);
342342
visitor.visit_trait_ref(trait_ref)
343343
}
344-
ItemImpl(_, _, ref type_parameters, ref opt_trait_reference, ref typ, ref impl_items) => {
344+
ItemImpl(.., ref type_parameters, ref opt_trait_reference, ref typ, ref impl_items) => {
345345
visitor.visit_id(item.id);
346346
visitor.visit_generics(type_parameters);
347347
walk_list!(visitor, visit_trait_ref, opt_trait_reference);
@@ -622,10 +622,10 @@ pub fn walk_fn_decl_nopat<'v, V: Visitor<'v>>(visitor: &mut V, function_declarat
622622

623623
pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) {
624624
match function_kind {
625-
FnKind::ItemFn(_, generics, _, _, _, _, _) => {
625+
FnKind::ItemFn(_, generics, ..) => {
626626
visitor.visit_generics(generics);
627627
}
628-
FnKind::Method(_, sig, _, _) => {
628+
FnKind::Method(_, sig, ..) => {
629629
visitor.visit_generics(&sig.generics);
630630
}
631631
FnKind::Closure(_) => {}

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
109109
this.insert(struct_def.id(), NodeStructCtor(struct_def));
110110
}
111111
}
112-
ItemTrait(_, _, ref bounds, _) => {
112+
ItemTrait(.., ref bounds, _) => {
113113
for b in bounds.iter() {
114114
if let TraitTyParamBound(ref t, TraitBoundModifier::None) = *b {
115115
this.insert(t.trait_ref.ref_id, NodeItem(i));

src/librustc/hir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl Pat {
469469
}
470470

471471
match self.node {
472-
PatKind::Binding(_, _, Some(ref p)) => p.walk_(it),
472+
PatKind::Binding(.., Some(ref p)) => p.walk_(it),
473473
PatKind::Struct(_, ref fields, _) => {
474474
fields.iter().all(|field| field.node.pat.walk_(it))
475475
}
@@ -486,7 +486,7 @@ impl Pat {
486486
}
487487
PatKind::Wild |
488488
PatKind::Lit(_) |
489-
PatKind::Range(_, _) |
489+
PatKind::Range(..) |
490490
PatKind::Binding(..) |
491491
PatKind::Path(..) => {
492492
true

src/librustc/hir/pat_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
5353

5454
pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
5555
match pat.node {
56-
PatKind::Lit(_) | PatKind::Range(_, _) | PatKind::Path(Some(..), _) => true,
56+
PatKind::Lit(_) | PatKind::Range(..) | PatKind::Path(Some(..), _) => true,
5757
PatKind::TupleStruct(..) |
5858
PatKind::Path(..) |
5959
PatKind::Struct(..) => {
@@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
6262
_ => false
6363
}
6464
}
65-
PatKind::Vec(_, _, _) => true,
65+
PatKind::Vec(..) => true,
6666
_ => false
6767
}
6868
}

src/librustc/infer/error_reporting.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
140140
Some(ast_map::NodeExpr(expr)) => match expr.node {
141141
hir::ExprCall(..) => "call",
142142
hir::ExprMethodCall(..) => "method call",
143-
hir::ExprMatch(_, _, hir::MatchSource::IfLetDesugar { .. }) => "if let",
144-
hir::ExprMatch(_, _, hir::MatchSource::WhileLetDesugar) => "while let",
145-
hir::ExprMatch(_, _, hir::MatchSource::ForLoopDesugar) => "for",
143+
hir::ExprMatch(.., hir::MatchSource::IfLetDesugar { .. }) => "if let",
144+
hir::ExprMatch(.., hir::MatchSource::WhileLetDesugar) => "while let",
145+
hir::ExprMatch(.., hir::MatchSource::ForLoopDesugar) => "for",
146146
hir::ExprMatch(..) => "match",
147147
_ => "expression",
148148
},
@@ -1787,7 +1787,7 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
17871787
let method_id_opt = match tcx.map.find(parent) {
17881788
Some(node) => match node {
17891789
ast_map::NodeItem(item) => match item.node {
1790-
hir::ItemFn(_, _, _, _, ref gen, _) => {
1790+
hir::ItemFn(.., ref gen, _) => {
17911791
taken.extend_from_slice(&gen.lifetimes);
17921792
None
17931793
},
@@ -1811,7 +1811,7 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
18111811
if let Some(node) = tcx.map.find(parent) {
18121812
match node {
18131813
ast_map::NodeItem(item) => match item.node {
1814-
hir::ItemImpl(_, _, ref gen, _, _, _) => {
1814+
hir::ItemImpl(_, _, ref gen, ..) => {
18151815
taken.extend_from_slice(&gen.lifetimes);
18161816
}
18171817
_ => ()

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
684684
warnings.extend(
685685
match self.region_vars.var_origin(vid) {
686686
LateBoundRegion(_,
687-
ty::BrNamed(_, _, wc),
687+
ty::BrNamed(.., wc),
688688
_) => Some(wc),
689689
_ => None,
690690
});

src/librustc/infer/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl TypeOrigin {
225225
&TypeOrigin::RelateOutputImplTypes(_) |
226226
&TypeOrigin::ExprAssignable(_) => "mismatched types",
227227
&TypeOrigin::MethodCompatCheck(_) => "method not compatible with trait",
228-
&TypeOrigin::MatchExpressionArm(_, _, source) => match source {
228+
&TypeOrigin::MatchExpressionArm(.., source) => match source {
229229
hir::MatchSource::IfLetDesugar{..} => "`if let` arms have incompatible types",
230230
_ => "match arms have incompatible types",
231231
},
@@ -248,7 +248,7 @@ impl TypeOrigin {
248248
&TypeOrigin::RelateOutputImplTypes(_) => {
249249
"trait type parameters matches those specified on the impl"
250250
}
251-
&TypeOrigin::MatchExpressionArm(_, _, _) => "match arms have compatible types",
251+
&TypeOrigin::MatchExpressionArm(..) => "match arms have compatible types",
252252
&TypeOrigin::IfExpression(_) => "if and else have compatible types",
253253
&TypeOrigin::IfExpressionWithNoElse(_) => "if missing an else returns ()",
254254
&TypeOrigin::RangeExpression(_) => "start and end of range have compatible types",
@@ -1712,7 +1712,7 @@ impl TypeOrigin {
17121712
TypeOrigin::ExprAssignable(span) => span,
17131713
TypeOrigin::Misc(span) => span,
17141714
TypeOrigin::RelateOutputImplTypes(span) => span,
1715-
TypeOrigin::MatchExpressionArm(match_span, _, _) => match_span,
1715+
TypeOrigin::MatchExpressionArm(match_span, ..) => match_span,
17161716
TypeOrigin::IfExpression(span) => span,
17171717
TypeOrigin::IfExpressionWithNoElse(span) => span,
17181718
TypeOrigin::RangeExpression(span) => span,
@@ -1765,7 +1765,7 @@ impl RegionVariableOrigin {
17651765
Autoref(a) => a,
17661766
Coercion(a) => a,
17671767
EarlyBoundRegion(a, _) => a,
1768-
LateBoundRegion(a, _, _) => a,
1768+
LateBoundRegion(a, ..) => a,
17691769
BoundRegionInCoherence(_) => syntax_pos::DUMMY_SP,
17701770
UpvarRegion(_, a) => a
17711771
}

0 commit comments

Comments
 (0)