repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/control-brace-style-always-same-line.rs | src/tools/rustfmt/tests/target/control-brace-style-always-same-line.rs | fn main() {
loop {
();
();
}
'label: loop
// loop comment
{
();
}
cond = true;
while cond {
();
}
'while_label: while cond {
// while comment
();
}
for obj in iter {
for sub_obj in obj {
'nested_while... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/type-alias-where-clauses-with-comments.rs | src/tools/rustfmt/tests/target/type-alias-where-clauses-with-comments.rs | type Foo
// comment1
// interlinear1
where
// comment2
// interlinear2
A: B, // comment3
C: D, // comment4
// interlinear3
= E; // comment5
type Foo
// comment6
// interlinear4
where
// comment7
// interlinear5
A: B, // comment8
C: D, // comment9
// interlinear6
= E
// comment10
// inte... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/struct_lits_visual.rs | src/tools/rustfmt/tests/target/struct_lits_visual.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
// rustfmt-indent_style: Visual
// Struct literal expressions.
fn main() {
let x = Bar;
// Comment
let y = Foo { a: x };
Foo { a: foo(), // comment
// comment
b: bar(),
..something };
Fooooooooooooo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/struct_lits_visual_multiline.rs | src/tools/rustfmt/tests/target/struct_lits_visual_multiline.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
// rustfmt-indent_style: Visual
// rustfmt-struct_lit_single_line: false
// Struct literal expressions.
fn main() {
let x = Bar;
// Comment
let y = Foo { a: x };
Foo { a: foo(), // comment
// comment
b: bar(),
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1681.rs | src/tools/rustfmt/tests/target/issue-1681.rs | // rustfmt-max_width: 80
// We would like to surround closure body with block when overflowing the last
// argument of function call if the last argument has condition and without
// block it may go multi lines.
fn foo() {
refmut_map_result(self.cache.borrow_mut(), |cache| {
match cache.entry(cache_key) {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_1306.rs | src/tools/rustfmt/tests/target/issue_1306.rs | // rustfmt-max_width: 160
// rustfmt-fn_call_width: 96
// rustfmt-fn_args_layout: Compressed
// rustfmt-trailing_comma: Always
// rustfmt-wrap_comments: true
fn foo() {
for elem in try!(gen_epub_book::ops::parse_descriptor_file(
&mut try!(File::open(&opts.source_file.1).map_err(|_| {
gen_epub_b... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1598.rs | src/tools/rustfmt/tests/target/issue-1598.rs | fn main() {
//foo
/*
*/
format!("hello");
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_4049.rs | src/tools/rustfmt/tests/target/issue_4049.rs | // rustfmt-max_width: 110
// rustfmt-use_small_heuristics: Max
// rustfmt-hard_tabs: true
// rustfmt-use_field_init_shorthand: true
// rustfmt-overflow_delimited_expr: true
// https://github.com/rust-lang/rustfmt/issues/4049
fn foo() {
{
{
if let Some(MpcEv::PlayDrum(pitch, vel)) =
// self.mpc.handle_input(e... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/else-if-brace-style-always-same-line.rs | src/tools/rustfmt/tests/target/else-if-brace-style-always-same-line.rs | fn main() {
if false {
();
();
}
if false
// lone if comment
{
();
();
}
let a = if 0 > 1 { unreachable!() } else { 0x0 };
if true {
();
} else if false {
();
();
} else {
();
();
();
}
if... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/comment4.rs | src/tools/rustfmt/tests/target/comment4.rs | #![allow(dead_code)] // bar
//! Doc comment
fn test() {
// comment
// comment2
code(); /* leave this comment alone!
* ok? */
/* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a
* diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
* viverra ne... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3158.rs | src/tools/rustfmt/tests/target/issue-3158.rs | // rustfmt-format_code_in_doc_comments: true
/// Should format
/// ```rust
/// assert!(false);
/// ```
///
/// Should format
/// ```rust,should_panic
/// assert!(false);
/// ```
///
/// Should format
/// ```rust,should_panic,edition2018
/// assert!(false);
/// ```
///
/// Should format
/// ```rust , should_panic , edi... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/struct_lits.rs | src/tools/rustfmt/tests/target/struct_lits.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
// Struct literal expressions.
fn main() {
let x = Bar;
// Comment
let y = Foo { a: x };
Foo {
a: foo(), // comment
// comment
b: bar(),
..something
};
Foooooooooooooooooooooooooooooooooooooooo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2551.rs | src/tools/rustfmt/tests/target/issue-2551.rs | mcro!(func(A {
a: 12345667800111111111111,
}));
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/fn-custom.rs | src/tools/rustfmt/tests/target/fn-custom.rs | // rustfmt-fn_params_layout: Compressed
// Test some of the ways function signatures can be customised.
// Test compressed layout of args.
fn foo(
a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd,
e: Eeeeeeeeeeeeeeeeeee,
) {
foo();
}
impl Foo {
fn foo(
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1693.rs | src/tools/rustfmt/tests/target/issue-1693.rs | fn issue1693() {
let pixel_data = vec![
(
f16::from_f32(0.82),
f16::from_f32(1.78),
f16::from_f32(0.21)
);
256 * 256
];
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/comment-not-disappear.rs | src/tools/rustfmt/tests/target/comment-not-disappear.rs | // All the comments here should not disappear.
fn a() {
match x {
X |
// A comment
Y => {}
};
}
fn b() {
match x {
X =>
// A comment
{
y
}
}
}
fn c() {
a() /* ... */;
}
fn foo() -> Vec<i32> {
(0..11)
.map(|x|
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/visibility.rs | src/tools/rustfmt/tests/target/visibility.rs | // #2398
pub mod outer_mod {
pub mod inner_mod {
pub(in outer_mod) fn outer_mod_visible_fn() {}
pub(super) fn super_mod_visible_fn() {}
pub(self) fn inner_mod_visible_fn() {}
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3241.rs | src/tools/rustfmt/tests/target/issue-3241.rs | // rustfmt-edition: 2018
use ::baz::{bar, foo};
use ::ignore;
use ::ignore::some::more;
use ::*;
use ::{bar, foo};
fn main() {
println!("Hello, world!");
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3651.rs | src/tools/rustfmt/tests/target/issue-3651.rs | fn f() -> Box<
dyn FnMut() -> Thing<
WithType = LongItemName,
Error = LONGLONGLONGLONGLONGONGEvenLongerErrorNameLongerLonger,
>,
> {
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/comments_unicode.rs | src/tools/rustfmt/tests/target/comments_unicode.rs | impl Default for WhitespaceCharacters {
fn default() -> Self {
Self {
space: '·', // U+00B7
nbsp: '⍽', // U+237D
tab: '→', // U+2192
newline: '⏎', // U+23CE
}
}
}
const RAINBOWS: &[&str] = &[
"rаinЬοѡ", // hue: 0
"raіnЬοw", // hue... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3132.rs | src/tools/rustfmt/tests/target/issue-3132.rs | // rustfmt-style_edition: 2024
fn test() {
/*
a
*/
let x = 42;
/*
aaa
"line 1
line 2
line 3"
*/
let x = 42;
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3314.rs | src/tools/rustfmt/tests/target/issue-3314.rs | /*code
/*code*/
if true {
println!("1");
}*/
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/fn.rs | src/tools/rustfmt/tests/target/fn.rs | // Tests different fns
fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {}
fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType
where
T: Blah,
{
}
fn foo(a: AAA /* (comment) */)
where
T: Blah,
{
}
fn foo(
a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
b: BBBBBBBBBBBBBBBBBBBBBBBBBB... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5399.rs | src/tools/rustfmt/tests/target/issue_5399.rs | // rustfmt-max_width: 140
impl NotificationRepository {
fn set_status_changed(
&self,
repo_tx_conn: &RepoTxConn,
rid: &RoutableId,
changed_at: NaiveDateTime,
) -> NukeResult<Option<NotificationStatus>> {
repo_tx_conn.run(move |conn| {
let res = diesel::update... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/unions.rs | src/tools/rustfmt/tests/target/unions.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
/// A Doc comment
#[AnAttribute]
pub union Foo {
#[rustfmt::skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
#[AnAttribute]
g: SomeOtherType,
/// A doc comment on a... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/where-clause-rfc.rs | src/tools/rustfmt/tests/target/where-clause-rfc.rs | fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
where
T: FOo,
U: Bar,
{
let mut effects = HashMap::new();
}
fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
where
T: FOo,
{
let mut effects = HashMap::new();
}
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/fn-args-with-last-line-comment.rs | src/tools/rustfmt/tests/target/fn-args-with-last-line-comment.rs | // #1587
pub trait X {
fn a(&self) -> &'static str;
fn bcd(
&self,
c: &str, // comment on this arg
d: u16, // comment on this arg
e: &Vec<String>, // comment on this arg
) -> Box<Q>;
}
// #1595
fn foo(
arg1: LongTypeName,
arg2: LongTypeName,
arg3... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/expr.rs | src/tools/rustfmt/tests/target/expr.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
// Test expressions
fn foo() -> bool {
let referenced = &5;
let very_long_variable_name = (a + first + simple + test);
let very_long_variable_name =
(a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB + b + c);
let ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5728.rs | src/tools/rustfmt/tests/target/issue_5728.rs | cfg_if::cfg_if! {
if #[cfg(windows)] {
} else if #(&cpus) {
} else [libc::CTL_HW, libc::HW_NCPU, 0, 0]
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/if_while_or_patterns.rs | src/tools/rustfmt/tests/target/if_while_or_patterns.rs | #![feature(if_while_or_patterns)]
fn main() {
if let 0 | 1 = 0 {
println!("hello, world");
};
if let aaaaaaaaaaaaaaaaaaaaaaaaaa | bbbbbbbbbbbbbbbbbbbbbbbbbbb | cccccccccccccccc | d_100 = 0 {
println!("hello, world");
}
if let aaaaaaaaaaaaaaaaaaaaaaaaaa | bbbbbbbbbbbbbbbbbbbbbbb | ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2896.rs | src/tools/rustfmt/tests/target/issue-2896.rs | extern crate differential_dataflow;
extern crate rand;
extern crate timely;
use rand::{Rng, SeedableRng, StdRng};
use timely::dataflow::operators::*;
use differential_dataflow::input::InputSession;
use differential_dataflow::operators::*;
use differential_dataflow::AsCollection;
// mod loglikelihoodratio;
fn main(... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1703.rs | src/tools/rustfmt/tests/target/issue-1703.rs | // rustfmt should not remove doc comments or comments inside attributes.
/**
This function has a block doc comment.
*/
fn test_function() {}
#[foo /* do not remove this! */]
fn foo() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/mulit-file.rs | src/tools/rustfmt/tests/target/mulit-file.rs | // Tests that where a single file is referred to in multiple places, we don't
// crash.
#[cfg(all(foo))]
#[path = "closure.rs"]
pub mod imp;
#[cfg(all(bar))]
#[path = "closure.rs"]
pub mod imp;
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/comment5.rs | src/tools/rustfmt/tests/target/comment5.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
//@ special comment
//@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec adiam lectus.
//@ Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
//@
//@ foo
fn test() {}
//@@@ another special comment
//@@@ Lorem ipsum dolor sit amet,... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5676.rs | src/tools/rustfmt/tests/target/issue_5676.rs | fn main() {
match true {
true => 'a: {
break 'a;
}
_ => (),
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/chains-visual.rs | src/tools/rustfmt/tests/target/chains-visual.rs | // rustfmt-indent_style: Visual
// Test chain formatting.
fn main() {
// Don't put chains on a single line if it wasn't so in source.
let a = b.c.d.1.foo(|x| x + 1);
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
.ddddddddddddddddddddddddddd();
bbbbbbbbbbbbbbbbbbb.cc... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-4210.rs | src/tools/rustfmt/tests/target/issue-4210.rs | // rustfmt-wrap_comments: true
/// Table that is > 80 symbols:
///
/// | table | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
/// |-------|-----------------------------------------------------------------------------|
/// | val | x ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/indented-impl.rs | src/tools/rustfmt/tests/target/indented-impl.rs | // rustfmt-brace_style: AlwaysNextLine
mod x
{
struct X(i8);
impl Y for X
{
fn y(self) -> ()
{
println!("ok");
}
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-691.rs | src/tools/rustfmt/tests/target/issue-691.rs | // rustfmt-normalize_comments: true
//! `std` or `core` and simply link to this library. In case the target
//! platform has no hardware
//! support for some operation, software implementations provided by this
//! library will be used automagically.
// TODO: provide instructions to override default libm link and how ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-850.rs | src/tools/rustfmt/tests/target/issue-850.rs | const unsafe fn x() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-5023.rs | src/tools/rustfmt/tests/target/issue-5023.rs | // rustfmt-wrap_comments: true
/// A comment to test special unicode characters on boundaries
/// 是,是,是,是,是,是,是,是,是,是,是,是 it should break right here
/// this goes to the next line
fn main() {
if xxx {
let xxx = xxx
.into_iter()
.filter(|(xxx, xxx)| {
if let Some(x) ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_4943.rs | src/tools/rustfmt/tests/target/issue_4943.rs | impl SomeStruct {
fn process<T>(v: T) -> <Self as GAT>::R<T>
where
Self: GAT<R<T> = T>,
{
SomeStruct::do_something(v)
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2496.rs | src/tools/rustfmt/tests/target/issue-2496.rs | // rustfmt-indent_style: Visual
fn main() {
match option {
None => some_function(first_reasonably_long_argument,
second_reasonably_long_argument),
}
}
fn main() {
match option {
None => some_function(first_reasonably_long_argument,
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5027.rs | src/tools/rustfmt/tests/target/issue_5027.rs | // rustfmt-style_edition: 2024
pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)>
+ ExactSizeIterator
+ 'a;
trait FOo {
pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)>
+ ExactSizeIterator
+ 'a;
}... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/associated_type_bounds.rs | src/tools/rustfmt/tests/target/associated_type_bounds.rs | // See #3657 - https://github.com/rust-lang/rustfmt/issues/3657
#![feature(associated_type_bounds)]
fn f<I: Iterator<Item: Clone>>() {}
fn g<I: Iterator<Item: Clone>>() {}
fn h<I: Iterator<Item: Clone>>() {}
fn i<I: Iterator<Item: Clone>>() {}
fn j<I: Iterator<Item: Clone + 'a>>() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1278.rs | src/tools/rustfmt/tests/target/issue-1278.rs | // rustfmt-indent_style = "block"
#![feature(pub_restricted)]
mod inner_mode {
pub(super) fn func_name(abc: i32) -> i32 {
abc
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/statements.rs | src/tools/rustfmt/tests/target/statements.rs | // FIXME(calebcartwright) - Hopefully one day we can
// elide these redundant semis like we do in other contexts.
fn redundant_item_semis() {
impl Foo {
fn get(&self) -> usize {
5
}
};
impl Bar {
fn get(&self) -> usize {
5
}
} /*asdfsf*/
;
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-4577.rs | src/tools/rustfmt/tests/target/issue-4577.rs | fn main() {
let s: String = "ABAABBAA"
.chars()
.filter(|c| if *c == 'A' { true } else { false })
.map(|c| -> char {
if c == 'A' {
'0'
} else {
'1'
}
})
.collect();
println!("{}", s);
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/item-brace-style-prefer-same-line.rs | src/tools/rustfmt/tests/target/item-brace-style-prefer-same-line.rs | // rustfmt-brace_style: PreferSameLine
mod M {
enum A {
A,
}
struct B {
b: i32,
}
enum C {}
struct D {}
enum A<T>
where
T: Copy, {
A,
}
struct B<T>
where
T: Copy, {
b: i32,
}
enum C<T>
where
T: Copy, {... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1468.rs | src/tools/rustfmt/tests/target/issue-1468.rs | fn issue1468() {
euc_jp_decoder_functions!({
let trail_minus_offset = byte.wrapping_sub(0xA1);
// Fast-track Hiragana (60% according to Lunde)
// and Katakana (10% according to Lunde).
if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 {
// Hiragana
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3845.rs | src/tools/rustfmt/tests/target/issue-3845.rs | fn main() {
|| {
#[allow(deprecated)]
{
u8::max_value()
}
};
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/fn_args_indent-block.rs | src/tools/rustfmt/tests/target/fn_args_indent-block.rs | // rustfmt-normalize_comments: true
fn foo() {
foo();
}
fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) {
foo();
}
fn bar(
a: Aaaaaaaaaaaaaa,
b: Bbbbbbbbbbbbbb,
c: Cccccccccccccccccc,
d: Dddddddddddddddd,
e: Eeeeeeeeeeeeeee,
) {
bar();
}
fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> S... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/closure-block-inside-macro.rs | src/tools/rustfmt/tests/target/closure-block-inside-macro.rs | // #1547
fuzz_target!(|data: &[u8]| if let Some(first) = data.first() {
let index = *first as usize;
if index >= ENCODINGS.len() {
return;
}
let encoding = ENCODINGS[index];
dispatch_test(encoding, &data[1..]);
});
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-4313.rs | src/tools/rustfmt/tests/target/issue-4313.rs | extern "C" {
fn f() {
fn g() {}
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/empty-tuple-no-conversion-to-unit-struct.rs | src/tools/rustfmt/tests/target/empty-tuple-no-conversion-to-unit-struct.rs | enum TestEnum {
Arm1(),
Arm2,
}
fn foo() {
let test = TestEnum::Arm1;
match test {
TestEnum::Arm1() => {}
TestEnum::Arm2 => {}
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2346.rs | src/tools/rustfmt/tests/target/issue-2346.rs | // rustfmt-normalize_comments: true
// the following empty comment should not have any trailing space added.
//
fn main() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/chains_with_comment.rs | src/tools/rustfmt/tests/target/chains_with_comment.rs | // Chains with comment.
fn main() {
let x = y // comment
.z;
foo // foo
// comment after parent
.x
.y
// comment 1
.bar() // comment after bar()
// comment 2
.foobar
// comment after
// comment 3
.baz(x, y, z);
self.r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/loop.rs | src/tools/rustfmt/tests/target/loop.rs | fn main() {
loop {
return some_val;
}
let x = loop {
do_forever();
};
'label: loop {
// Just comments
}
'a: while loooooooooooooooooooooooooooooooooong_variable_name + another_value > some_other_value
{
}
while aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2520.rs | src/tools/rustfmt/tests/target/issue-2520.rs | // rustfmt-normalize_comments: true
// rustfmt-format_code_in_doc_comments: true
//! ```rust
//! println!("hello, world");
//! ```
#![deny(missing_docs)]
//! ```rust
//! println!("hello, world");
#![deny(missing_docs)]
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2922.rs | src/tools/rustfmt/tests/target/issue-2922.rs | // rustfmt-indent_style: Visual
struct Functions {
RunListenServer: unsafe extern "C" fn(*mut c_void,
*mut c_char,
*mut c_char,
*mut c_char,
*mut c_... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1211.rs | src/tools/rustfmt/tests/target/issue-1211.rs | fn main() {
for iface in &ifaces {
match iface.addr {
get_if_addrs::IfAddr::V4(ref addr) => match addr.broadcast {
Some(ip) => {
sock.send_to(&buf, (ip, 8765)).expect("foobar");
}
_ => (),
},
_ => (),
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/raw_identifiers.rs | src/tools/rustfmt/tests/target/raw_identifiers.rs | #![feature(custom_attribute)]
#![feature(raw_identifiers)]
#![feature(extern_types)]
#![allow(invalid_type_param_default)]
#![allow(unused_attributes)]
use r#foo as r#alias_foo;
// https://github.com/rust-lang/rustfmt/issues/3837
pub(crate) static r#break: &'static str = "foo";
fn main() {
#[r#attr]
r#foo::r... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/visual-fn-type.rs | src/tools/rustfmt/tests/target/visual-fn-type.rs | // rustfmt-indent_style: Visual
type CNodeSetAtts = unsafe extern "C" fn(node: *const RsvgNode,
node_impl: *const RsvgCNodeImpl,
handle: *const RsvgHandle,
pbag: *const PropertyBag);
type CNodeDraw... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/immovable_coroutines.rs | src/tools/rustfmt/tests/target/immovable_coroutines.rs | #![feature(coroutines)]
unsafe fn foo() {
let mut ga = #[coroutine]
static || {
yield 1;
};
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2123.rs | src/tools/rustfmt/tests/target/issue-2123.rs | // rustfmt-wrap_comments: true
//hello
//world
fn main() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_3853.rs | src/tools/rustfmt/tests/target/issue_3853.rs | fn by_ref_with_block_before_ident() {
if let Some(ref /*def*/ state) = foo {
println!("asdfasdfasdf");
}
}
fn mut_block_before_ident() {
if let Some(mut /*def*/ state) = foo {
println!("123");
}
}
fn ref_and_mut_blocks_before_ident() {
if let Some(ref /*abc*/ mut /*def*/ state) = f... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_4573.rs | src/tools/rustfmt/tests/target/issue_4573.rs | // rustmft-version:Two
// rustmft-use_small_heuristics:Max
// rustmft-merge_derives:false
// These are the same rustfmt configuration options that are used
// in the comiler as of ce39461ca75a and 8eb7c58dbb7b
// These are commits in https://github.com/rust-lang/rust
#![no_std] // inner attribute comment
// inner attr... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/pattern.rs | src/tools/rustfmt/tests/target/pattern.rs | // rustfmt-normalize_comments: true
#![feature(exclusive_range_pattern)]
use core::u8::MAX;
fn main() {
let z = match x {
"pat1" => 1,
(ref x, ref mut y /* comment */) => 2,
};
if let <T as Trait>::CONST = ident {
do_smth();
}
let Some(ref xyz /* comment! */) = opt;
i... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5691.rs | src/tools/rustfmt/tests/target/issue_5691.rs | struct S<const C: usize>
where
[(); { num_slots!(C) }]:, {
/* An asterisk-based, or a double-slash-prefixed, comment here is
required to trigger the fmt bug.
A single-line triple-slash-prefixed comment (with a field following it) is not enough - it will not trigger the fmt bug.
Side note: If yo... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_6082.rs | src/tools/rustfmt/tests/target/issue_6082.rs | macro_rules! test {
($T:ident, $b:lifetime) => {
Box<$T<$b>>
};
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/one_line_if_v2.rs | src/tools/rustfmt/tests/target/one_line_if_v2.rs | // rustfmt-style_edition: 2024
fn plain_if(x: bool) -> u8 {
if x { 0 } else { 1 }
}
fn paren_if(x: bool) -> u8 {
(if x { 0 } else { 1 })
}
fn let_if(x: bool) -> u8 {
let x = if x { foo() } else { bar() };
x
}
fn return_if(x: bool) -> u8 {
return if x { 0 } else { 1 };
}
fn multi_if() {
use ... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3645.rs | src/tools/rustfmt/tests/target/issue-3645.rs | mod x {
use super::self as x;
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2941.rs | src/tools/rustfmt/tests/target/issue-2941.rs | // rustfmt-wrap_comments: true
//! ```
//! \
//! ```
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_5912.rs | src/tools/rustfmt/tests/target/issue_5912.rs | // rustfmt-match_arm_blocks: false
// rustfmt-control_brace_style: AlwaysNextLine
fn foo() {
match 0
{
0 =>
aaaaaaaaaaaaaaaaaaaaaaaa
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbb... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3423.rs | src/tools/rustfmt/tests/target/issue-3423.rs | /* a nice comment with a trailing whitespace */
fn foo() {}
/* a nice comment with a trailing tab */
fn bar() {}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-4398.rs | src/tools/rustfmt/tests/target/issue-4398.rs | impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
impl Struct {
/// Documentation for `foo`
#[rustfmt::skip] // comment on why use a skip here
pub fn foo(&self) {}
}
/// Documentation for `Struct`
#[rustfmt::skip] // comment
imp... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/match-block-trailing-comma.rs | src/tools/rustfmt/tests/target/match-block-trailing-comma.rs | // rustfmt-match_block_trailing_comma: true
// Match expressions, no unwrapping of block arms or wrapping of multiline
// expressions.
fn foo() {
match x {
a => {
"line1";
"line2"
},
ThisIsA::Guard if true => {
"line1";
"line2"
},
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/file-lines-item.rs | src/tools/rustfmt/tests/target/file-lines-item.rs | // rustfmt-file_lines: [{"file":"tests/source/file-lines-item.rs","range":[6,8]}]
use foo::{c, b, a};
use bar;
fn foo() {
bar();
}
impl Drop for Context {
fn drop(&mut self) {
}
}
impl Bar for Baz {
fn foo() {
bar(
baz, // Who knows?
)
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-4603.rs | src/tools/rustfmt/tests/target/issue-4603.rs | // Formatting when original macro snippet is used
// Original issue #4603 code
#![feature(or_patterns)]
macro_rules! t_or_f {
() => {
(true // some comment
| false)
};
}
// Other test cases variations
macro_rules! RULES {
() => {
(
xxxxxxx // COMMENT
| yyyyyyy
)
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/invalid-rust-code-in-doc-comment.rs | src/tools/rustfmt/tests/target/invalid-rust-code-in-doc-comment.rs | // rustfmt-format_code_in_doc_comments: true
/// ```rust
/// if (true) { … }
/// ```
fn a() {}
/// ```rust
/// if foo() {
/// …
/// }
/// ```
fn a() {}
/// ```rust
/// k1 == k2 ⇒ hash(k1) == hash(k2)
/// ```
pub struct a;
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/soft-wrapping.rs | src/tools/rustfmt/tests/target/soft-wrapping.rs | // rustfmt-wrap_comments: true
// rustfmt-max_width: 80
// Soft wrapping for comments.
// #535, soft wrapping for comments
// Compare the lowest `f32` of both inputs for greater than or equal. The
// lowest 32 bits of the result will be `0xffffffff` if `a.extract(0)` is
// ggreater than or equal `b.extract(0)`, or `0`... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/multiple.rs | src/tools/rustfmt/tests/target/multiple.rs | // rustfmt-normalize_comments: true
// rustfmt-wrap_comments: true
// rustfmt-format_strings: true
// Test of lots of random stuff.
// FIXME split this into multiple, self-contained tests.
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
#[attr1]
extern crate foo;
#[attr2]
#[attr3]
extern crate foo;
use... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_4257.rs | src/tools/rustfmt/tests/target/issue_4257.rs | trait Trait<T> {
type Type<'a>
where
T: 'a;
fn foo(x: &T) -> Self::Type<'_>;
}
impl<T> Trait<T> for () {
type Type<'a>
where
T: 'a,
= &'a T;
fn foo(x: &T) -> Self::Type<'_> {
x
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1192.rs | src/tools/rustfmt/tests/target/issue-1192.rs | fn main() {
assert!(true);
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/file-lines-7.rs | src/tools/rustfmt/tests/target/file-lines-7.rs | // rustfmt-file_lines: [{"file":"tests/source/file-lines-7.rs","range":[8,15]}]
struct A {
t: i64,
}
mod foo {
fn bar() {
// test
let i = 12;
// test
}
fn baz() {
///
let j = 15;
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/5131_module.rs | src/tools/rustfmt/tests/target/5131_module.rs | // rustfmt-imports_granularity: Module
#![allow(dead_code)]
mod a {
pub mod b {
pub struct Data {
pub a: i32,
}
}
use crate::a::b::{Data, Data as Data2};
pub fn data(a: i32) -> Data {
Data { a }
}
pub fn data2(a: i32) -> Data2 {
Data2 { a }
}
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/binary-expr.rs | src/tools/rustfmt/tests/target/binary-expr.rs | // Binary expressions
fn foo() {
// 100
let x = aaaaaaaaaa || bbbbbbbbbb || cccccccccc || dddddddddd && eeeeeeeeee || ffffffffff || ggg;
// 101
let x =
aaaaaaaaaa || bbbbbbbbbb || cccccccccc || dddddddddd && eeeeeeeeee || ffffffffff || gggg;
// 104
let x = aaaaaaaaaa
|| bbbbbbbb... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/one_line_if_v1.rs | src/tools/rustfmt/tests/target/one_line_if_v1.rs | // rustfmt-style_edition: 2015
fn plain_if(x: bool) -> u8 {
if x {
0
} else {
1
}
}
fn paren_if(x: bool) -> u8 {
(if x { 0 } else { 1 })
}
fn let_if(x: bool) -> u8 {
let x = if x { foo() } else { bar() };
x
}
fn return_if(x: bool) -> u8 {
return if x { 0 } else { 1 };
}
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_4579.rs | src/tools/rustfmt/tests/target/issue_4579.rs | // rustfmt-hard_tabs: true
#[macro_export]
macro_rules! main {
() => {
#[spirv(fragment)]
pub fn main_fs(
mut out_color: ::spirv_std::storage_class::Output<Vec4>,
#[spirv(descriptor_set = 1)]
iChannelResolution: ::spirv_std::storage_class::UniformConstant<
[::spirv_std::glam::Vec3A; 4],
>,
) {
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/comments-fn.rs | src/tools/rustfmt/tests/target/comments-fn.rs | // Test comments on functions are preserved.
// Comment on foo.
fn foo<F, G>(
a: aaaaaaaaaaaaa, // A comment
b: bbbbbbbbbbbbb, // a second comment
c: ccccccccccccc,
// Newline comment
d: ddddddddddddd,
// A multi line comment
// between args.
e: eeeeeeeeeeeee, /* comment before paren *... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-3465.rs | src/tools/rustfmt/tests/target/issue-3465.rs | fn main() {
((((((((((((((((((((((((((((((((((((((((((0) + 1) + 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
+ 1)
... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-2103.rs | src/tools/rustfmt/tests/target/issue-2103.rs | struct X
where
i32: Sized,
{
x: i32,
}
struct X
// with comment
where
i32: Sized,
{
x: i32,
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/doc.rs | src/tools/rustfmt/tests/target/doc.rs | // rustfmt-normalize_comments: true
// Part of multiple.rs
// sadfsdfa
// sdffsdfasdf
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/mod-1.rs | src/tools/rustfmt/tests/target/mod-1.rs | // Deeply indented modules.
mod foo {
mod bar {
mod baz {}
}
}
mod foo {
mod bar {
mod baz {
fn foo() {
bar()
}
}
}
mod qux {}
}
mod boxed {
pub use std::boxed::{Box, HEAP};
}
pub mod x {
pub fn freopen(
filename: *... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/obsolete_in_place.rs | src/tools/rustfmt/tests/target/obsolete_in_place.rs | // #2953
macro_rules! demo {
($a:ident <- $b:expr) => {};
}
fn main() {
demo!(i <- 0);
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1021.rs | src/tools/rustfmt/tests/target/issue-1021.rs | // rustfmt-normalize_comments: true
fn main() {
match x {
S(true, .., true) => (),
S(true, ..) => (),
S(.., true) => (),
S(..) => (),
S(_) => (),
S(/* .. */ ..) => (),
S(/* .. */ .., true) => (),
}
match y {
(true, .., true) => (),
(tr... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-1055.rs | src/tools/rustfmt/tests/target/issue-1055.rs | fn issue_1055() {
let foo = (|| {})();
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue_6159.rs | src/tools/rustfmt/tests/target/issue_6159.rs | fn main() {
builtin # type_ascribe(10, usize)
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/async_block.rs | src/tools/rustfmt/tests/target/async_block.rs | // rustfmt-edition: 2018
fn main() {
let x = async { Ok(()) };
}
fn baz() {
// test
let x = async {
// async blocks are great
Ok(())
};
let y = async { Ok(()) }; // comment
spawn(a, async move {
action();
Ok(())
});
spawn(a, async move || {
ac... | rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
rust-lang/rust | https://github.com/rust-lang/rust/blob/f8b1d59a81c700cb7aa25cf69e3032b3ce333150/src/tools/rustfmt/tests/target/issue-945.rs | src/tools/rustfmt/tests/target/issue-945.rs | impl Bar {
default const unsafe fn foo() {
"hi"
}
}
impl Baz {
default unsafe extern "C" fn foo() {
"hi"
}
}
impl Foo for Bar {
default fn foo() {
"hi"
}
}
| rust | Apache-2.0 | f8b1d59a81c700cb7aa25cf69e3032b3ce333150 | 2026-01-04T15:31:58.503980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.