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), || []);
137 println!("dsfs"); // a comment
141 let hello = &format!(
142 "HTTP/1.1 200 OK\r\nServer: {}\r\n\r\n{}",
143 "65454654654654654654654655464", "4"
149 (#[$attr:meta] $name:ident) => {};
164 b: types::Timestamptz,
173 init_size[1] - extreeeeeeeeeeeeeeeeeeeeeeeem..init_size[1],
175 ]).par_map_inplace(|el| *el = 0.);
186 .collect::<Vec<_>>();
192 fn test(a: String, s: String, b: String) -> TestResult {
193 if a.find(&s).is_none() {
195 TestResult::from_bool(true)
197 TestResult::discard()
207 static ref ONE: u32 = 1;
208 static ref TWO: u32 = 2;
209 static ref THREE: u32 = 3;
210 static ref FOUR: u32 = {
227 vbuf: gfx::VertexBuffer<Vertex> = (),
228 out: gfx::RenderTarget<ColorFormat> = "Target0",
233 fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
235 ::std::mem::size_of::<HandleWithDtor<::std::os::raw::c_int>>(),
238 "Size of template specialization: ",
239 stringify!(HandleWithDtor<::std::os::raw::c_int>)
243 ::std::mem::align_of::<HandleWithDtor<::std::os::raw::c_int>>(),
246 "Alignment of template specialization: ",
247 stringify!(HandleWithDtor<::std::os::raw::c_int>)
253 macro_rules! try_opt {
266 // macro call whose argument is an array with trailing comma.
269 str_searcher_ascii_haystack,
282 fn special_case_macros() {
284 let q = eprint!("{}", 1);
286 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
287 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
290 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
319 let q = eprintln!("{}", 1);
321 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
322 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
325 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
354 let q = format!("{}", 1);
356 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
357 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
360 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
389 let q = format_args!("{}", 1);
390 let r = format_args!(
391 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
392 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
394 let s = format_args!(
395 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
424 let q = print!("{}", 1);
426 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
427 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
430 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
459 let q = println!("{}", 1);
461 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
462 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
465 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
494 let q = unreachable!("{}", 1);
495 let r = unreachable!(
496 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
497 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
499 let s = unreachable!(
500 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
531 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
532 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
535 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
566 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
567 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
570 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
601 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
602 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
605 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
636 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
637 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
640 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
671 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
672 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
675 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
705 assert!(result == 42);
706 assert!(result == 42, "Ahoy there, {}!", target);
709 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
716 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
747 assert_eq!(left, right);
748 assert_eq!(left, right, "Ahoy there, {}!", target);
751 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
752 result, input, expected
755 first_realllllllllllly_long_variable_that_doesnt_fit_one_one_line,
756 second_reallllllllllly_long_variable_that_doesnt_fit_one_one_line,
757 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
765 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
773 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
802 write!(&mut s, "Ahoy there, {}!", target);
805 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
806 result, input, expected
810 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
839 writeln!(&mut s, "Ahoy there, {}!", target);
842 "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
843 result, input, expected
847 "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
880 pub fn foo(&self) -> Bar<foo!()> {}
884 fn macro_in_pattern_position() {
888 bar!(a, b, c,) => (),
889 baz!(1 + 2 + 3, quux.kaas()) => (),
891 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
892 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
899 pub macro bar($x:ident + $y:expr;) {
902 a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
921 macro lex_err($kind: ident $(, $body: expr)*) {
922 Err(QlError::LexError(LexError::$kind($($body,)*)))
925 // Preserve trailing comma on item-level macro with `()` or `[]`.
926 methods![get, post, delete,];
927 methods!(get, post, delete,);
947 _ => unreachable!(/* obviously */),
952 let _ = column!(/* here */);
956 // Preserve trailing comma when using mixed layout for macro call.
959 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
963 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,
964 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,
969 // Preserve trailing comma inside macro, even if it looks an array.
972 $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]);