Skip to content

Commit cc2272f

Browse files
committed
Formatting
1 parent 21f2e93 commit cc2272f

File tree

1 file changed

+45
-24
lines changed

1 file changed

+45
-24
lines changed

src/libsyntax/parse/lexer/tests.rs

+45-24
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ fn t1() {
3535
with_default_globals(|| {
3636
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
3737
let sh = mk_sess(sm.clone());
38-
let mut string_reader = setup(&sm,
39-
&sh,
40-
"/* my source file */ fn main() { println!(\"zebra\"); }\n"
41-
.to_string());
38+
let mut string_reader = setup(
39+
&sm,
40+
&sh,
41+
"/* my source file */ fn main() { println!(\"zebra\"); }\n".to_string(),
42+
);
4243
assert_eq!(string_reader.next_token(), token::Comment);
4344
assert_eq!(string_reader.next_token(), token::Whitespace);
4445
let tok1 = string_reader.next_token();
@@ -134,8 +135,10 @@ fn character_a() {
134135
with_default_globals(|| {
135136
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
136137
let sh = mk_sess(sm.clone());
137-
assert_eq!(setup(&sm, &sh, "'a'".to_string()).next_token(),
138-
mk_lit(token::Char, "a", None));
138+
assert_eq!(
139+
setup(&sm, &sh, "'a'".to_string()).next_token(),
140+
mk_lit(token::Char, "a", None),
141+
);
139142
})
140143
}
141144

@@ -144,8 +147,10 @@ fn character_space() {
144147
with_default_globals(|| {
145148
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
146149
let sh = mk_sess(sm.clone());
147-
assert_eq!(setup(&sm, &sh, "' '".to_string()).next_token(),
148-
mk_lit(token::Char, " ", None));
150+
assert_eq!(
151+
setup(&sm, &sh, "' '".to_string()).next_token(),
152+
mk_lit(token::Char, " ", None),
153+
);
149154
})
150155
}
151156

@@ -154,8 +159,10 @@ fn character_escaped() {
154159
with_default_globals(|| {
155160
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
156161
let sh = mk_sess(sm.clone());
157-
assert_eq!(setup(&sm, &sh, "'\\n'".to_string()).next_token(),
158-
mk_lit(token::Char, "\\n", None));
162+
assert_eq!(
163+
setup(&sm, &sh, "'\\n'".to_string()).next_token(),
164+
mk_lit(token::Char, "\\n", None),
165+
);
159166
})
160167
}
161168

@@ -164,8 +171,10 @@ fn lifetime_name() {
164171
with_default_globals(|| {
165172
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
166173
let sh = mk_sess(sm.clone());
167-
assert_eq!(setup(&sm, &sh, "'abc".to_string()).next_token(),
168-
token::Lifetime(Symbol::intern("'abc")));
174+
assert_eq!(
175+
setup(&sm, &sh, "'abc".to_string()).next_token(),
176+
token::Lifetime(Symbol::intern("'abc")),
177+
);
169178
})
170179
}
171180

@@ -174,8 +183,10 @@ fn raw_string() {
174183
with_default_globals(|| {
175184
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
176185
let sh = mk_sess(sm.clone());
177-
assert_eq!(setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string()).next_token(),
178-
mk_lit(token::StrRaw(3), "\"#a\\b\x00c\"", None));
186+
assert_eq!(
187+
setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string()).next_token(),
188+
mk_lit(token::StrRaw(3), "\"#a\\b\x00c\"", None),
189+
);
179190
})
180191
}
181192

@@ -186,11 +197,15 @@ fn literal_suffixes() {
186197
let sh = mk_sess(sm.clone());
187198
macro_rules! test {
188199
($input: expr, $tok_type: ident, $tok_contents: expr) => {{
189-
assert_eq!(setup(&sm, &sh, format!("{}suffix", $input)).next_token(),
190-
mk_lit(token::$tok_type, $tok_contents, Some("suffix")));
200+
assert_eq!(
201+
setup(&sm, &sh, format!("{}suffix", $input)).next_token(),
202+
mk_lit(token::$tok_type, $tok_contents, Some("suffix")),
203+
);
191204
// with a whitespace separator:
192-
assert_eq!(setup(&sm, &sh, format!("{} suffix", $input)).next_token(),
193-
mk_lit(token::$tok_type, $tok_contents, None));
205+
assert_eq!(
206+
setup(&sm, &sh, format!("{} suffix", $input)).next_token(),
207+
mk_lit(token::$tok_type, $tok_contents, None),
208+
);
194209
}}
195210
}
196211

@@ -204,12 +219,18 @@ fn literal_suffixes() {
204219
test!("1.0", Float, "1.0");
205220
test!("1.0e10", Float, "1.0e10");
206221

207-
assert_eq!(setup(&sm, &sh, "2us".to_string()).next_token(),
208-
mk_lit(token::Integer, "2", Some("us")));
209-
assert_eq!(setup(&sm, &sh, "r###\"raw\"###suffix".to_string()).next_token(),
210-
mk_lit(token::StrRaw(3), "raw", Some("suffix")));
211-
assert_eq!(setup(&sm, &sh, "br###\"raw\"###suffix".to_string()).next_token(),
212-
mk_lit(token::ByteStrRaw(3), "raw", Some("suffix")));
222+
assert_eq!(
223+
setup(&sm, &sh, "2us".to_string()).next_token(),
224+
mk_lit(token::Integer, "2", Some("us")),
225+
);
226+
assert_eq!(
227+
setup(&sm, &sh, "r###\"raw\"###suffix".to_string()).next_token(),
228+
mk_lit(token::StrRaw(3), "raw", Some("suffix")),
229+
);
230+
assert_eq!(
231+
setup(&sm, &sh, "br###\"raw\"###suffix".to_string()).next_token(),
232+
mk_lit(token::ByteStrRaw(3), "raw", Some("suffix")),
233+
);
213234
})
214235
}
215236

0 commit comments

Comments
 (0)