8984438a6f
Fixes 5270 Previously, rustfmt only checked the `merge_derives` configuration value to determine if it should merge_derives. This lead to derives being merged even when annotated with the `rustfmt::skip` attribute. Now, rustfmt also checks if derives are explicitly being skipped in the current context via the `rustfmt::skip` attribute.
63 lines
1.1 KiB
Rust
63 lines
1.1 KiB
Rust
// rustfmt-merge_derives:false
|
|
|
|
#[rustfmt::skip::attributes(derive)]
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
struct DoNotMergeDerives {
|
|
field: String,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[rustfmt::skip::attributes(derive)]
|
|
#[derive(Clone)]
|
|
struct DoNotMergeDerivesSkipInMiddle {
|
|
field: String,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
#[rustfmt::skip::attributes(derive)]
|
|
struct DoNotMergeDerivesSkipAtEnd {
|
|
field: String,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
struct MergeDerives {
|
|
field: String,
|
|
}
|
|
|
|
mod inner_attribute_derive_skip {
|
|
#![rustfmt::skip::attributes(derive)]
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
struct DoNotMergeDerives {
|
|
field: String,
|
|
}
|
|
}
|
|
|
|
#[rustfmt::skip::attributes(derive)]
|
|
mod outer_attribute_derive_skip {
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
struct DoNotMergeDerives {
|
|
field: String,
|
|
}
|
|
}
|
|
|
|
mod no_derive_skip {
|
|
#[allow(dead_code)]
|
|
#[derive(StructField)]
|
|
#[derive(Clone)]
|
|
struct MergeDerives {
|
|
field: String,
|
|
}
|
|
}
|