Skip to content

Commit e9ac440

Browse files
committed
Auto merge of #29383 - petrochenkov:empstr, r=pnkfelix
Fixes #28692 Fixes #28992 Fixes some other similar issues (see the tests) [breaking-change], needs crater run (cc @brson or @alexcrichton ) The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
2 parents bac2b13 + af96402 commit e9ac440

33 files changed

+192
-127
lines changed

src/librustc/middle/intrinsicck.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,10 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
225225
intravisit::walk_fn(self, fk, fd, b, s);
226226
self.param_envs.pop();
227227
}
228-
FnKind::Closure(..) => {
228+
FnKind::Closure => {
229229
intravisit::walk_fn(self, fk, fd, b, s);
230230
}
231231
}
232-
233232
}
234233

235234
fn visit_expr(&mut self, expr: &hir::Expr) {

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ impl<'tcx> cmt_<'tcx> {
14241424
NonAliasable
14251425
}
14261426

1427-
Categorization::StaticItem(..) => {
1427+
Categorization::StaticItem => {
14281428
if self.mutbl.is_mutable() {
14291429
FreelyAliasable(AliasableStaticMut)
14301430
} else {

src/librustc/middle/resolve_lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
184184
this.walk_fn(fk, fd, b, s)
185185
})
186186
}
187-
FnKind::Closure(..) => {
187+
FnKind::Closure => {
188188
self.walk_fn(fk, fd, b, s)
189189
}
190190
}
@@ -479,7 +479,7 @@ impl<'a> LifetimeContext<'a> {
479479
self.visit_generics(&sig.generics);
480480
self.visit_explicit_self(&sig.explicit_self);
481481
}
482-
FnKind::Closure(..) => {
482+
FnKind::Closure => {
483483
intravisit::walk_fn_decl(self, fd);
484484
}
485485
}

src/librustc/middle/traits/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
300300
ty::TyInt(..) |
301301
ty::TyUint(..) |
302302
ty::TyFloat(..) |
303-
ty::TyStr(..) |
303+
ty::TyStr |
304304
ty::TyBareFn(..) |
305305
ty::TyArray(..) |
306306
ty::TySlice(..) |

src/librustc/middle/traits/select.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15631563
}
15641564

15651565
match other {
1566-
&ObjectCandidate(..) |
1566+
&ObjectCandidate |
15671567
&ParamCandidate(_) | &ProjectionCandidate => match victim {
15681568
&DefaultImplCandidate(..) => {
15691569
self.tcx().sess.bug(
@@ -1572,16 +1572,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15721572
}
15731573
&ImplCandidate(..) |
15741574
&ClosureCandidate(..) |
1575-
&FnPointerCandidate(..) |
1576-
&BuiltinObjectCandidate(..) |
1577-
&BuiltinUnsizeCandidate(..) |
1575+
&FnPointerCandidate |
1576+
&BuiltinObjectCandidate |
1577+
&BuiltinUnsizeCandidate |
15781578
&DefaultImplObjectCandidate(..) |
15791579
&BuiltinCandidate(..) => {
15801580
// We have a where-clause so don't go around looking
15811581
// for impls.
15821582
true
15831583
}
1584-
&ObjectCandidate(..) |
1584+
&ObjectCandidate |
15851585
&ProjectionCandidate => {
15861586
// Arbitrarily give param candidates priority
15871587
// over projection and object candidates.

src/librustc/middle/ty/outlives.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,21 @@ fn compute_components<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
188188
// the type and then visits the types that are lexically
189189
// contained within. (The comments refer to relevant rules
190190
// from RFC1214.)
191-
ty::TyBool(..) | // OutlivesScalar
192-
ty::TyChar(..) | // OutlivesScalar
191+
ty::TyBool | // OutlivesScalar
192+
ty::TyChar | // OutlivesScalar
193193
ty::TyInt(..) | // OutlivesScalar
194194
ty::TyUint(..) | // OutlivesScalar
195195
ty::TyFloat(..) | // OutlivesScalar
196196
ty::TyEnum(..) | // OutlivesNominalType
197197
ty::TyStruct(..) | // OutlivesNominalType
198198
ty::TyBox(..) | // OutlivesNominalType (ish)
199-
ty::TyStr(..) | // OutlivesScalar (ish)
199+
ty::TyStr | // OutlivesScalar (ish)
200200
ty::TyArray(..) | // ...
201201
ty::TySlice(..) | // ...
202202
ty::TyRawPtr(..) | // ...
203203
ty::TyRef(..) | // OutlivesReference
204204
ty::TyTuple(..) | // ...
205-
ty::TyError(..) => {
205+
ty::TyError => {
206206
push_region_constraints(out, ty.regions());
207207
for subty in ty.walk_shallow() {
208208
compute_components(infcx, subty, out);

src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,14 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
540540
ol, old_loan_msg)
541541
}
542542

543-
euv::OverloadedOperator(..) |
544-
euv::AddrOf(..) |
545-
euv::AutoRef(..) |
546-
euv::AutoUnsafe(..) |
547-
euv::ClosureInvocation(..) |
548-
euv::ForLoop(..) |
549-
euv::RefBinding(..) |
550-
euv::MatchDiscriminant(..) => {
543+
euv::OverloadedOperator |
544+
euv::AddrOf |
545+
euv::AutoRef |
546+
euv::AutoUnsafe |
547+
euv::ClosureInvocation |
548+
euv::ForLoop |
549+
euv::RefBinding |
550+
euv::MatchDiscriminant => {
551551
format!("previous borrow of `{}` occurs here{}",
552552
ol, old_loan_msg)
553553
}

src/librustc_borrowck/borrowck/gather_loans/restrictions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
101101
self.extend(result, &cmt, LpInterior(i.cleaned()))
102102
}
103103

104-
Categorization::StaticItem(..) => {
104+
Categorization::StaticItem => {
105105
Safe
106106
}
107107

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
942942
"consider changing this closure to take self by mutable reference");
943943
}
944944
}
945-
mc::AliasableStatic(..) |
946-
mc::AliasableStaticMut(..) => {
945+
mc::AliasableStatic |
946+
mc::AliasableStaticMut => {
947947
span_err!(
948948
self.tcx.sess, span, E0388,
949949
"{} in a static location", prefix);
@@ -998,7 +998,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
998998
pub fn note_and_explain_bckerr(&self, err: BckError<'tcx>) {
999999
let code = err.code;
10001000
match code {
1001-
err_mutbl(..) => {
1001+
err_mutbl => {
10021002
match err.cmt.note {
10031003
mc::NoteClosureEnv(upvar_id) | mc::NoteUpvarRef(upvar_id) => {
10041004
// If this is an `Fn` closure, it simply can't mutate upvars.

src/librustc_mir/build/matches/simplify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a,'tcx> Builder<'a,'tcx> {
6666
candidate: &mut Candidate<'pat, 'tcx>)
6767
-> Result<BasicBlock, MatchPair<'pat, 'tcx>> {
6868
match *match_pair.pattern.kind {
69-
PatternKind::Wild(..) => {
69+
PatternKind::Wild => {
7070
// nothing left to do
7171
Ok(block)
7272
}

0 commit comments

Comments
 (0)