rust/tests/source/configs/enum_discrim_align_threshold/40.rs
moxian 65ae0b9a09 Change enum align semantics to care about absolute length, rather than difference.
If we're only aligning enum discriminants that are "not too far apart
(length-wise)", then this works really well for enums with
consistently-long or consistently-short idents, but not for the mixed
ones.
However, consistently-long idents is somewhate of an uncommon case and
overlong idents may be allowed to be formatted suboptimally if that
makes mixed-length idents work better (and it does in this case).
2018-09-26 18:47:17 +00:00

34 lines
790 B
Rust

// rustfmt-enum_discrim_align_threshold: 40
enum Standard {
A = 1,
Bcdef = 2,
}
enum NoDiscrims {
ThisIsAFairlyLongEnumVariantWithoutDiscrimLongerThan40,
A = 1,
ThisIsAnotherFairlyLongEnumVariantWithoutDiscrimLongerThan40,
Bcdef = 2,
}
enum TooLong {
ThisOneHasDiscrimAaaaaaaaaaaaaaaaaaaaaaChar40 = 10,
A = 1,
Bcdef = 2,
}
enum Borderline {
ThisOneHasDiscrimAaaaaaaaaaaaaaaaaaaaaa = 10,
A = 1,
Bcdef = 2,
}
// Live specimen from #1686
enum LongWithSmallDiff {
SceneColorimetryEstimates = 0x73636F65,
SceneAppearanceEstimates = 0x73617065,
FocalPlaneColorimetryEstimates = 0x66706365,
ReflectionHardcopyOriginalColorimetry = 0x72686F63,
ReflectionPrintOutputColorimetry = 0x72706F63,
}