Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e80654a

Browse files
committed
Fix run-make test
1 parent 5cb4f4e commit e80654a

File tree

1 file changed

+60
-56
lines changed
  • src/test/run-make-fulldeps/save-analysis

1 file changed

+60
-56
lines changed

src/test/run-make-fulldeps/save-analysis/foo.rs

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![ crate_name = "test" ]
1+
#![crate_name = "test"]
22
#![feature(box_syntax)]
33
#![feature(rustc_private)]
44
#![feature(associated_type_defaults)]
@@ -11,11 +11,10 @@ extern crate krate2;
1111
extern crate krate2 as krate3;
1212

1313
use rustc_graphviz::RenderOption;
14-
use std::collections::{HashMap,HashSet};
1514
use std::cell::RefCell;
15+
use std::collections::{HashMap, HashSet};
1616
use std::io::Write;
1717

18-
1918
use sub::sub2 as msalias;
2019
use sub::sub2;
2120
use sub::sub2::nested_struct as sub_struct;
@@ -32,7 +31,7 @@ static bob: Option<rustc_graphviz::RenderOption> = None;
3231
// buglink test - see issue #1337.
3332

3433
fn test_alias<I: Iterator>(i: Option<<I as Iterator>::Item>) {
35-
let s = sub_struct{ field2: 45u32, };
34+
let s = sub_struct { field2: 45u32 };
3635

3736
// import tests
3837
fn foo(x: &Write) {}
@@ -82,7 +81,7 @@ mod sub {
8281

8382
pub enum nested_enum {
8483
Nest2 = 2,
85-
Nest3 = 3
84+
Nest3 = 3,
8685
}
8786
}
8887
}
@@ -103,7 +102,9 @@ struct some_fields {
103102
type SF = some_fields;
104103

105104
trait SuperTrait {
106-
fn qux(&self) { panic!(); }
105+
fn qux(&self) {
106+
panic!();
107+
}
107108
}
108109

109110
trait SomeTrait: SuperTrait {
@@ -131,8 +132,7 @@ impl SomeTrait for some_fields {
131132
}
132133
}
133134

134-
impl SuperTrait for some_fields {
135-
}
135+
impl SuperTrait for some_fields {}
136136

137137
impl SubTrait for some_fields {}
138138

@@ -145,17 +145,14 @@ impl some_fields {
145145
42
146146
}
147147

148-
fn align_to<T>(&mut self) {
149-
150-
}
148+
fn align_to<T>(&mut self) {}
151149

152150
fn test(&mut self) {
153151
self.align_to::<bool>();
154152
}
155153
}
156154

157-
impl SuperTrait for nofields {
158-
}
155+
impl SuperTrait for nofields {}
159156
impl SomeTrait for nofields {
160157
fn Method(&self, x: u32) -> u32 {
161158
self.Method(x);
@@ -181,59 +178,70 @@ enum SomeEnum<'a> {
181178
Ints(isize, isize),
182179
Floats(f64, f64),
183180
Strings(&'a str, &'a str, &'a str),
184-
MyTypes(MyType, MyType)
181+
MyTypes(MyType, MyType),
185182
}
186183

187184
#[derive(Copy, Clone)]
188185
enum SomeOtherEnum {
189186
SomeConst1,
190187
SomeConst2,
191-
SomeConst3
188+
SomeConst3,
192189
}
193190

194191
enum SomeStructEnum {
195-
EnumStruct{a:isize, b:isize},
196-
EnumStruct2{f1:MyType, f2:MyType},
197-
EnumStruct3{f1:MyType, f2:MyType, f3:SomeEnum<'static>}
192+
EnumStruct { a: isize, b: isize },
193+
EnumStruct2 { f1: MyType, f2: MyType },
194+
EnumStruct3 { f1: MyType, f2: MyType, f3: SomeEnum<'static> },
198195
}
199196

200197
fn matchSomeEnum(val: SomeEnum) {
201198
match val {
202-
SomeEnum::Ints(int1, int2) => { println(&(int1+int2).to_string()); }
203-
SomeEnum::Floats(float1, float2) => { println(&(float2*float1).to_string()); }
204-
SomeEnum::Strings(.., s3) => { println(s3); }
205-
SomeEnum::MyTypes(mt1, mt2) => { println(&(mt1.field1 - mt2.field1).to_string()); }
199+
SomeEnum::Ints(int1, int2) => {
200+
println(&(int1 + int2).to_string());
201+
}
202+
SomeEnum::Floats(float1, float2) => {
203+
println(&(float2 * float1).to_string());
204+
}
205+
SomeEnum::Strings(.., s3) => {
206+
println(s3);
207+
}
208+
SomeEnum::MyTypes(mt1, mt2) => {
209+
println(&(mt1.field1 - mt2.field1).to_string());
210+
}
206211
}
207212
}
208213

209214
fn matchSomeStructEnum(se: SomeStructEnum) {
210215
match se {
211-
SomeStructEnum::EnumStruct{a:a, ..} => println(&a.to_string()),
212-
SomeStructEnum::EnumStruct2{f1:f1, f2:f_2} => println(&f_2.field1.to_string()),
213-
SomeStructEnum::EnumStruct3{f1, ..} => println(&f1.field1.to_string()),
216+
SomeStructEnum::EnumStruct { a: a, .. } => println(&a.to_string()),
217+
SomeStructEnum::EnumStruct2 { f1: f1, f2: f_2 } => println(&f_2.field1.to_string()),
218+
SomeStructEnum::EnumStruct3 { f1, .. } => println(&f1.field1.to_string()),
214219
}
215220
}
216221

217-
218222
fn matchSomeStructEnum2(se: SomeStructEnum) {
219223
use SomeStructEnum::*;
220224
match se {
221-
EnumStruct{a: ref aaa, ..} => println(&aaa.to_string()),
222-
EnumStruct2{f1, f2: f2} => println(&f1.field1.to_string()),
223-
EnumStruct3{f1, f3: SomeEnum::Ints(..), f2} => println(&f1.field1.to_string()),
224-
_ => {},
225+
EnumStruct { a: ref aaa, .. } => println(&aaa.to_string()),
226+
EnumStruct2 { f1, f2: f2 } => println(&f1.field1.to_string()),
227+
EnumStruct3 { f1, f3: SomeEnum::Ints(..), f2 } => println(&f1.field1.to_string()),
228+
_ => {}
225229
}
226230
}
227231

228232
fn matchSomeOtherEnum(val: SomeOtherEnum) {
229233
use SomeOtherEnum::{SomeConst2, SomeConst3};
230234
match val {
231-
SomeOtherEnum::SomeConst1 => { println("I'm const1."); }
232-
SomeConst2 | SomeConst3 => { println("I'm const2 or const3."); }
235+
SomeOtherEnum::SomeConst1 => {
236+
println("I'm const1.");
237+
}
238+
SomeConst2 | SomeConst3 => {
239+
println("I'm const2 or const3.");
240+
}
233241
}
234242
}
235243

236-
fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
244+
fn hello<X: SomeTrait>((z, a): (u32, String), ex: X) {
237245
SameDir2::hello(43);
238246

239247
println(&yy.to_string());
@@ -248,8 +256,8 @@ fn hello<X: SomeTrait>((z, a) : (u32, String), ex: X) {
248256
let x = 32.0f32;
249257
let _ = (x + ((x * x) + 1.0).sqrt()).ln();
250258

251-
let s: Box<SomeTrait> = box some_fields {field1: 43};
252-
let s2: Box<some_fields> = box some_fields {field1: 43};
259+
let s: Box<SomeTrait> = box some_fields { field1: 43 };
260+
let s2: Box<some_fields> = box some_fields { field1: 43 };
253261
let s3 = box nofields;
254262

255263
s.Method(43);
@@ -302,8 +310,9 @@ mod macro_use_test {
302310
}
303311
}
304312

305-
fn main() { // foo
306-
let s = box some_fields {field1: 43};
313+
fn main() {
314+
// foo
315+
let s = box some_fields { field1: 43 };
307316
hello((43, "a".to_string()), *s);
308317
sub::sub2::hello();
309318
sub2::sub3::hello();
@@ -324,26 +333,24 @@ fn main() { // foo
324333
let vs = variable_str!(32);
325334

326335
let mut candidates: RefCell<HashMap<&'static str, &'static str>> = RefCell::new(HashMap::new());
327-
let _ = blah {
328-
used_link_args: RefCell::new([]),
329-
};
336+
let _ = blah { used_link_args: RefCell::new([]) };
330337
let s1 = nofields;
331-
let s2 = SF { field1: 55};
332-
let s3: some_fields = some_fields{ field1: 55};
333-
let s4: msalias::nested_struct = sub::sub2::nested_struct{ field2: 55};
334-
let s4: msalias::nested_struct = sub2::nested_struct{ field2: 55};
338+
let s2 = SF { field1: 55 };
339+
let s3: some_fields = some_fields { field1: 55 };
340+
let s4: msalias::nested_struct = sub::sub2::nested_struct { field2: 55 };
341+
let s4: msalias::nested_struct = sub2::nested_struct { field2: 55 };
335342
println(&s2.field1.to_string());
336-
let s5: MyType = box some_fields{ field1: 55};
337-
let s = SameDir::SameStruct{name: "Bob".to_string()};
338-
let s = SubDir::SubStruct{name:"Bob".to_string()};
343+
let s5: MyType = box some_fields { field1: 55 };
344+
let s = SameDir::SameStruct { name: "Bob".to_string() };
345+
let s = SubDir::SubStruct { name: "Bob".to_string() };
339346
let s6: SomeEnum = SomeEnum::MyTypes(box s2.clone(), s5);
340347
let s7: SomeEnum = SomeEnum::Strings("one", "two", "three");
341348
matchSomeEnum(s6);
342349
matchSomeEnum(s7);
343350
let s8: SomeOtherEnum = SomeOtherEnum::SomeConst2;
344351
matchSomeOtherEnum(s8);
345-
let s9: SomeStructEnum = SomeStructEnum::EnumStruct2{ f1: box some_fields{ field1:10 },
346-
f2: box s2 };
352+
let s9: SomeStructEnum =
353+
SomeStructEnum::EnumStruct2 { f1: box some_fields { field1: 10 }, f2: box s2 };
347354
matchSomeStructEnum(s9);
348355

349356
for x in &vec![1, 2, 3] {
@@ -404,8 +411,7 @@ impl<'a> Pattern<'a> for CharEqPattern {
404411

405412
struct CharSearcher<'a>(<CharEqPattern as Pattern<'a>>::Searcher);
406413

407-
pub trait Error {
408-
}
414+
pub trait Error {}
409415

410416
impl Error + 'static {
411417
pub fn is<T: Error + 'static>(&self) -> bool {
@@ -419,8 +425,7 @@ impl Error + 'static + Send {
419425
}
420426
}
421427
extern crate rustc_serialize;
422-
#[derive(Clone, Copy, Hash, RustcEncodable, RustcDecodable,
423-
PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
428+
#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
424429
struct AllDerives(i32);
425430

426431
fn test_format_args() {
@@ -433,9 +438,8 @@ fn test_format_args() {
433438
print!("x is {}, y is {1}, name is {n}", x, y, n = name);
434439
}
435440

436-
437441
union TestUnion {
438-
f1: u32
442+
f1: u32,
439443
}
440444

441445
struct FrameBuffer;
@@ -454,5 +458,5 @@ trait Foo {
454458
type Bar = FrameBuffer;
455459
}
456460

457-
#[doc(include="extra-docs.md")]
461+
#[doc(include = "extra-docs.md")]
458462
struct StructWithDocs;

0 commit comments

Comments
 (0)