1 // rustfmt-normalize_comments: true
2 // rustfmt-format_macro_matchers: true
3 itemmacro!(this, is.now() .formatted(yay));
5 itemmacro!(really, long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb() .is.formatted());
7 itemmacro!{this, is.bracket().formatted()}
9 peg_file! modname ("mygrammarfile.rustpeg");
20 baz!(1+2+3, quux. kaas());
22 quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB);
24 kaas!(/* comments */ a /* post macro */, b /* another */);
26 trailingcomma!( a , b , c , );
27 // Preserve trailing comma only when necessary.
30 table.map(|table| fixture.offset(table)).unwrap_or(0),
34 noexpr!( i am not an expression, OK? );
38 vec! [AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA,
39 BBBBB, 5, 100-30, 1.33, b, b, b];
41 vec! [a /* comment */];
43 // Trailing spaces after a comma
55 vec![a; (|x| { let y = x + 1; let z = y + 1; z })(2)];
56 vec![a; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx];
61 unknown_bracket_macro__comma_should_not_be_stripped![
69 macrowithbraces! {dont, format, me}
94 let image = gray_image!(
100 chain!(input, a:take!(max_size), || []);
110 // Don't format empty either!
115 println!("dsfs"); // a comment
119 let hello = &format!("HTTP/1.1 200 OK\r\nServer: {}\r\n\r\n{}",
120 "65454654654654654654654655464",
126 (#[$attr:meta] $name:ident) => {}
129 foo!(#[doc = "bar"] baz);
133 sql_function!(add_rss_item,
136 b: types::Timestamptz,
141 w.slice_mut(s![.., init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1], ..])
142 .par_map_inplace(|el| *el = 0.);
146 let threads = people.into_iter().map(|name| {
150 }).collect::<Vec<_>>();
156 fn test(a: String, s: String, b: String) -> TestResult {
157 if a.find(&s).is_none() {
159 TestResult::from_bool(true)
161 TestResult::discard()
171 static ref ONE: u32 = 1;
172 static ref TWO: u32 = 2;
173 static ref THREE: u32 = 3;
174 static ref FOUR: u32 = {
193 if let Some(debug) = error.debug_info() {
195 "errorKind": format!("{:?}", error.err_kind()),
196 "debugMessage": debug.message,
199 json!({"errorKind": format!("{:?}", error.err_kind())})
204 vbuf: gfx::VertexBuffer<Vertex> = (),
205 out: gfx::RenderTarget<ColorFormat> = "Target0",
210 fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
212 ::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
215 "Size of template specialization: ",
216 stringify ! ( HandleWithDtor < :: std :: os :: raw :: c_int > )
219 assert_eq ! ( :: std :: mem :: align_of :: < HandleWithDtor < :: std :: os :: raw :: c_int > > ( ) , 8usize , concat ! ( "Alignment of template specialization: " , stringify ! ( HandleWithDtor < :: std :: os :: raw :: c_int > ) ) );
223 macro_rules! try_opt {
224 ($expr:expr) => (match $expr {
227 None => { return None; }
232 // macro call whose argument is an array with trailing comma.
234 make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
243 fn special_case_macros() {
245 let q = eprint!("{}", 1);
246 let r = eprint!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
247 let s = eprint!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
249 let q = eprintln!("{}", 1);
250 let r = eprintln!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
251 let s = eprintln!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
253 let q = format!("{}", 1);
254 let r = format!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
255 let s = format!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
257 let q = format_args!("{}", 1);
258 let r = format_args!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
259 let s = format_args!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
261 let q = print!("{}", 1);
262 let r = print!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
263 let s = print!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
265 let q = println!("{}", 1);
266 let r = println!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
267 let s = println!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
269 let q = unreachable!("{}", 1);
270 let r = unreachable!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
271 let s = unreachable!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
274 debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
275 debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
278 error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
279 error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
282 info!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
283 info!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
286 panic!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
287 panic!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
290 warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
291 warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
294 assert!(result == 42);
295 assert!(result == 42, "Ahoy there, {}!", target);
296 assert!(result == 42, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
297 assert!(result == 42, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
301 assert_eq!(left, right);
302 assert_eq!(left, right, "Ahoy there, {}!", target);
303 assert_eq!(left, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
304 assert_eq!(first_realllllllllllly_long_variable_that_doesnt_fit_one_one_line, second_reallllllllllly_long_variable_that_doesnt_fit_one_one_line, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
305 assert_eq!(left + 42, right, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
306 assert_eq!(left, right, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
308 write!(&mut s, "Ahoy there, {}!", target);
309 write!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
310 write!(&mut s, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
312 writeln!(&mut s, "Ahoy there, {}!", target);
313 writeln!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
314 writeln!(&mut s, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
320 pub fn foo(&self) -> Bar<foo!( )> {}
324 fn macro_in_pattern_position () {
333 baz!( 1 + 2 + 3, quux.kaas( )
335 quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) => (),
344 pub macro bar($x:ident+$y:expr; ) {
346 long_function(a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
364 macro lex_err($kind: ident $(, $body: expr)*) {
365 Err(QlError::LexError(LexError::$kind($($body,)*)))
368 // Preserve trailing comma on item-level macro with `()` or `[]`.
369 methods![ get, post, delete, ];
370 methods!( get, post, delete, );
390 _ => unreachable!(/* obviously */),
395 let _ = column!(/* here */);
399 // Preserve trailing comma when using mixed layout for macro call.
401 foo!(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
402 foo!(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,);
406 // Preserve trailing comma inside macro, even if it looks an array.
409 $m!([a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]);
414 // Preserve trailing comma-less/ness inside nested macro.
416 do_parse_gsv<GsvData>,
419 number_of_sentences: map_res!(digit, parse_num::<u16>)
421 >> sentence_index: map_res!(digit, parse_num::<u16>)
423 >> total_number_of_sats: map_res!(digit, parse_num::<u16>)
425 >> sat0: opt!(complete!(parse_gsv_sat_info))
426 >> sat1: opt!(complete!(parse_gsv_sat_info))
427 >> sat2: opt!(complete!(parse_gsv_sat_info))
428 >> sat3: opt!(complete!(parse_gsv_sat_info))
432 total_number_of_sats,
444 convert_args!(vec!(1, 2, 3));
448 /// TLV Holds a set of JSTraceables that need to be rooted
449 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
450 RefCell::new(RootedTraceableSet::new()) ;
454 /// TLV Holds a set of JSTraceables that need to be rooted
455 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
456 RefCell::new(RootedTraceableSet::new()) ;
458 /// TLV Holds a set of JSTraceables that need to be rooted
459 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
460 RefCell::new(RootedTraceableSet::new(0)) ;
462 /// TLV Holds a set of JSTraceables that need to be rooted
463 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
464 RefCell::new(RootedTraceableSet::new(), xxx, yyy) ;
466 /// TLV Holds a set of JSTraceables that need to be rooted
467 static ROOTED_TRACEABLES: RefCell<RootedTraceableSet> =
468 RefCell::new(RootedTraceableSet::new(1234)) ;