Skip to content

Commit 0723d6c

Browse files
committed
Pacify tidy.
1 parent 57c31b2 commit 0723d6c

File tree

4 files changed

+89
-59
lines changed

4 files changed

+89
-59
lines changed

src/librustc/middle/traits/error_reporting.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
286286
struct_enum_tys.iter()
287287
.enumerate()
288288
.filter_map(|(index, ty)| match ty.sty {
289-
ty::TyEnum(adt_def, _) | ty::TyStruct(adt_def, _) if adt_def.did.is_local() =>
289+
ty::TyEnum(adt_def, _) | ty::TyStruct(adt_def, _)
290+
if adt_def.did.is_local() =>
290291
Some((index, adt_def.did)),
291292
_ =>
292293
None,

src/librustc_data_structures/obligation_forest/node_index.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
111
use core::nonzero::NonZero;
212
use std::u32;
313

src/librustc_data_structures/obligation_forest/test.rs

+75-57
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
111
use super::{ObligationForest, Outcome, Error};
212

313
#[test]
@@ -86,42 +96,46 @@ fn success_in_grandchildren() {
8696
let mut forest = ObligationForest::new();
8797
forest.push_root("A");
8898

89-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
90-
match *obligation {
91-
"A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
92-
_ => unreachable!(),
93-
}
94-
});
99+
let Outcome { successful: ok, errors: err, .. } =
100+
forest.process_obligations::<(),_>(|obligation, _| {
101+
match *obligation {
102+
"A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
103+
_ => unreachable!(),
104+
}
105+
});
95106
assert!(ok.is_empty());
96107
assert!(err.is_empty());
97108

98-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
99-
match *obligation {
100-
"A.1" => Ok(Some(vec![])),
101-
"A.2" => Ok(Some(vec!["A.2.i", "A.2.ii"])),
102-
"A.3" => Ok(Some(vec![])),
103-
_ => unreachable!(),
104-
}
105-
});
109+
let Outcome { successful: ok, errors: err, .. } =
110+
forest.process_obligations::<(),_>(|obligation, _| {
111+
match *obligation {
112+
"A.1" => Ok(Some(vec![])),
113+
"A.2" => Ok(Some(vec!["A.2.i", "A.2.ii"])),
114+
"A.3" => Ok(Some(vec![])),
115+
_ => unreachable!(),
116+
}
117+
});
106118
assert_eq!(ok, vec!["A.3", "A.1"]);
107119
assert!(err.is_empty());
108120

109-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
110-
match *obligation {
111-
"A.2.i" => Ok(Some(vec!["A.2.i.a"])),
112-
"A.2.ii" => Ok(Some(vec![])),
113-
_ => unreachable!(),
114-
}
115-
});
121+
let Outcome { successful: ok, errors: err, .. } =
122+
forest.process_obligations::<(),_>(|obligation, _| {
123+
match *obligation {
124+
"A.2.i" => Ok(Some(vec!["A.2.i.a"])),
125+
"A.2.ii" => Ok(Some(vec![])),
126+
_ => unreachable!(),
127+
}
128+
});
116129
assert_eq!(ok, vec!["A.2.ii"]);
117130
assert!(err.is_empty());
118131

119-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
120-
match *obligation {
121-
"A.2.i.a" => Ok(Some(vec![])),
122-
_ => unreachable!(),
123-
}
124-
});
132+
let Outcome { successful: ok, errors: err, .. } =
133+
forest.process_obligations::<(),_>(|obligation, _| {
134+
match *obligation {
135+
"A.2.i.a" => Ok(Some(vec![])),
136+
_ => unreachable!(),
137+
}
138+
});
125139
assert_eq!(ok, vec!["A.2.i.a", "A.2.i", "A.2", "A"]);
126140
assert!(err.is_empty());
127141

@@ -137,12 +151,13 @@ fn to_errors_no_throw() {
137151
// only yields one of them (and does not panic, in particular).
138152
let mut forest = ObligationForest::new();
139153
forest.push_root("A");
140-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, _| {
141-
match *obligation {
142-
"A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
143-
_ => unreachable!(),
144-
}
145-
});
154+
let Outcome { successful: ok, errors: err, .. } =
155+
forest.process_obligations::<(),_>(|obligation, _| {
156+
match *obligation {
157+
"A" => Ok(Some(vec!["A.1", "A.2", "A.3"])),
158+
_ => unreachable!(),
159+
}
160+
});
146161
assert_eq!(ok.len(), 0);
147162
assert_eq!(err.len(), 0);
148163
let errors = forest.to_errors(());
@@ -155,34 +170,37 @@ fn backtrace() {
155170
// only yields one of them (and does not panic, in particular).
156171
let mut forest: ObligationForest<&'static str> = ObligationForest::new();
157172
forest.push_root("A");
158-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
159-
assert!(backtrace.next().is_none());
160-
match *obligation {
161-
"A" => Ok(Some(vec!["A.1"])),
162-
_ => unreachable!(),
163-
}
164-
});
173+
let Outcome { successful: ok, errors: err, .. } =
174+
forest.process_obligations::<(),_>(|obligation, mut backtrace| {
175+
assert!(backtrace.next().is_none());
176+
match *obligation {
177+
"A" => Ok(Some(vec!["A.1"])),
178+
_ => unreachable!(),
179+
}
180+
});
165181
assert!(ok.is_empty());
166182
assert!(err.is_empty());
167-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
168-
assert!(backtrace.next().unwrap() == &"A");
169-
assert!(backtrace.next().is_none());
170-
match *obligation {
171-
"A.1" => Ok(Some(vec!["A.1.i"])),
172-
_ => unreachable!(),
173-
}
174-
});
183+
let Outcome { successful: ok, errors: err, .. } =
184+
forest.process_obligations::<(),_>(|obligation, mut backtrace| {
185+
assert!(backtrace.next().unwrap() == &"A");
186+
assert!(backtrace.next().is_none());
187+
match *obligation {
188+
"A.1" => Ok(Some(vec!["A.1.i"])),
189+
_ => unreachable!(),
190+
}
191+
});
175192
assert!(ok.is_empty());
176193
assert!(err.is_empty());
177-
let Outcome { successful: ok, errors: err, .. } = forest.process_obligations::<(),_>(|obligation, mut backtrace| {
178-
assert!(backtrace.next().unwrap() == &"A.1");
179-
assert!(backtrace.next().unwrap() == &"A");
180-
assert!(backtrace.next().is_none());
181-
match *obligation {
182-
"A.1.i" => Ok(None),
183-
_ => unreachable!(),
184-
}
185-
});
194+
let Outcome { successful: ok, errors: err, .. } =
195+
forest.process_obligations::<(),_>(|obligation, mut backtrace| {
196+
assert!(backtrace.next().unwrap() == &"A.1");
197+
assert!(backtrace.next().unwrap() == &"A");
198+
assert!(backtrace.next().is_none());
199+
match *obligation {
200+
"A.1.i" => Ok(None),
201+
_ => unreachable!(),
202+
}
203+
});
186204
assert_eq!(ok.len(), 0);
187205
assert!(err.is_empty());
188206
}

src/librustc_typeck/check/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4142,7 +4142,8 @@ pub fn check_representable(tcx: &ty::ctxt,
41424142
// caught by case 1.
41434143
match rty.is_representable(tcx, sp) {
41444144
Representability::SelfRecursive => {
4145-
traits::recursive_type_with_infinite_size_error(tcx, tcx.map.local_def_id(item_id)).emit();
4145+
let item_def_id = tcx.map.local_def_id(item_id);
4146+
traits::recursive_type_with_infinite_size_error(tcx, item_def_id).emit();
41464147
return false
41474148
}
41484149
Representability::Representable | Representability::ContainsRecursive => (),

0 commit comments

Comments
 (0)