1 // rustfmt-normalize_comments: true
2 itemmacro!(this, is.now().formatted(yay));
6 long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb()
11 itemmacro!{this, is.bracket().formatted()}
13 peg_file! modname("mygrammarfile.rustpeg");
24 baz!(1 + 2 + 3, quux.kaas());
27 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
28 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
37 trailingcomma!(a, b, c,);
38 // Preserve trailing comma only when necessary.
39 ok!(file.seek(SeekFrom::Start(
40 table.map(|table| fixture.offset(table)).unwrap_or(0),
43 noexpr!( i am not an expression, OK? );
66 vec![a /* comment */];
68 // Trailing spaces after a comma
88 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
90 vec![a; unsafe { x + 1 }];
92 unknown_bracket_macro__comma_should_not_be_stripped![a,];
98 macrowithbraces! {dont, format, me}
120 let image = gray_image!(
126 chain!(input, a: take!(max_size), || []);
134 println!("dsfs"); // a comment
138 let hello = &format!(
139 "HTTP/1.1 200 OK\r\nServer: {}\r\n\r\n{}",
140 "65454654654654654654654655464", "4"
146 (#[$attr:meta] $name:ident) => {};
161 b: types::Timestamptz,
170 init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1],
172 ]).par_map_inplace(|el| *el = 0.);
183 .collect::<Vec<_>>();
189 fn test(a: String, s: String, b: String) -> TestResult {
190 if a.find(&s).is_none() {
192 TestResult::from_bool(true)
194 TestResult::discard()
204 static ref ONE: u32 = 1;
205 static ref TWO: u32 = 2;
206 static ref THREE: u32 = 3;
207 static ref FOUR: u32 = {
224 vbuf: gfx::VertexBuffer<Vertex> = (),
225 out: gfx::RenderTarget<ColorFormat> = "Target0",
230 fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
232 ::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
235 "Size of template specialization: ",
236 stringify!(HandleWithDtor<::std::os::raw::c_int>)
240 ::std::mem::align_of::<HandleWithDtor<::std::os::raw::c_int>>(),
243 "Alignment of template specialization: ",
244 stringify!(HandleWithDtor<::std::os::raw::c_int>)
250 macro_rules! try_opt {
263 // macro call whose argument is an array with trailing comma.
266 str_searcher_ascii_haystack,
279 fn special_case_macros() {
281 let q = eprint!("{}", 1);
283 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
284 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
287 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
316 let q = eprintln!("{}", 1);
318 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
319 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
322 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
351 let q = format!("{}", 1);
353 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
354 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
357 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
386 let q = format_args!("{}", 1);
387 let r = format_args!(
388 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
389 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
391 let s = format_args!(
392 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
421 let q = print!("{}", 1);
423 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
424 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
427 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
456 let q = println!("{}", 1);
458 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
459 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
462 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
491 let q = unreachable!("{}", 1);
492 let r = unreachable!(
493 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
494 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
496 let s = unreachable!(
497 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
528 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
529 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
532 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
563 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
564 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
567 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
598 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
599 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
602 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
633 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
634 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
637 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
668 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
669 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
672 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
702 assert!(result == 42);
703 assert!(result == 42, "Ahoy there, {}!", target);
706 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
713 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
744 assert_eq!(left, right);
745 assert_eq!(left, right, "Ahoy there, {}!", target);
748 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
749 result, input, expected
752 first_realllllllllllly_long_variable_that_doesnt_fit_one_one_line,
753 second_reallllllllllly_long_variable_that_doesnt_fit_one_one_line,
754 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
762 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
770 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
799 write!(&mut s, "Ahoy there, {}!", target);
802 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
803 result, input, expected
807 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
836 writeln!(&mut s, "Ahoy there, {}!", target);
839 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
840 result, input, expected
844 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
877 pub fn foo(&self) -> Bar<foo!()> {}
881 fn macro_in_pattern_position() {
885 bar!(a, b, c,) => (),
886 baz!(1 + 2 + 3, quux.kaas()) => (),
888 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
889 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
896 pub macro bar($x:ident + $y:expr;) {
899 a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
918 macro lex_err($kind: ident $(, $body: expr)*) {
919 Err(QlError::LexError(LexError::$kind($($body,)*)))
922 // Preserve trailing comma on item-level macro with `()` or `[]`.
923 methods![get, post, delete,];
924 methods!(get, post, delete,);
944 _ => unreachable!(/* obviously */),
949 let _ = column!(/* here */);
953 // Preserve trailing comma when using mixed layout for macro call.
956 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,
957 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
960 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,
961 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,
966 // Preserve trailing comma inside macro, even if it looks an array.
969 $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]);