Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ Control the case of the letters in hexadecimal literal values

- **Default value**: `Preserve`
- **Possible values**: `Preserve`, `Upper`, `Lower`
- **Stable**: No (tracking issue: [#5081](https://github.com/rust-lang/rustfmt/issues/5081))
- **Stable**: Yes

## `float_literal_trailing_zero`

Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ create_config! {
"Format the bodies of declarative macro definitions";
skip_macro_invocations: SkipMacroInvocations, false,
"Skip formatting the bodies of macros invoked with the following names.";
hex_literal_case: HexLiteralCaseConfig, false, "Format hexadecimal integer literals";
hex_literal_case: HexLiteralCaseConfig, true, "Format hexadecimal integer literals";
float_literal_trailing_zero: FloatLiteralTrailingZeroConfig, false,
"Add or remove trailing zero in floating-point literals";

Expand Down
9 changes: 9 additions & 0 deletions tests/source/configs/hex_literal_case/hex_literal_lower.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Lower
fn main() {
let h1 = 0xCAFE_5EA7;
let h2 = 0xCAFE_F00Du32;
let h3 = -0xCAFE_5EA7;
let h4 = -0xCAFE_F00Di32;
Comment thread
tapanprakasht marked this conversation as resolved.
let h5 = 0xABcD07_i32;
let h6 = -0xABcD07_i32;
}
9 changes: 9 additions & 0 deletions tests/source/configs/hex_literal_case/hex_literal_preserve.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Preserve
fn main() {
let h1 = 0xcAfE_5Ea7;
let h2 = 0xCaFe_F00du32;
let h3 = -0xcAfE_5Ea7;
let h4 = -0xCaFe_F00di32;
let h5 = 0xAbcd07_i32;
let h6 = -0xAbcd07_i32;
}
9 changes: 9 additions & 0 deletions tests/source/configs/hex_literal_case/hex_literal_upper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Upper
fn main() {
let h1 = 0xCaFE_5ea7;
let h2 = 0xCAFE_F00Du32;
let h3 = -0xCaFE_5ea7;
let h4 = -0xCAFE_F00Di32;
let h5 = 0xAbcd07_i32;
let h6 = -0xAbcd07_i32;
}
5 changes: 0 additions & 5 deletions tests/source/hex_literal_lower.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/source/hex_literal_upper.rs

This file was deleted.

9 changes: 9 additions & 0 deletions tests/target/configs/hex_literal_case/hex_literal_lower.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Lower
fn main() {
let h1 = 0xcafe_5ea7;
let h2 = 0xcafe_f00du32;
let h3 = -0xcafe_5ea7;
let h4 = -0xcafe_f00di32;
let h5 = 0xabcd07_i32;
let h6 = -0xabcd07_i32;
}
9 changes: 9 additions & 0 deletions tests/target/configs/hex_literal_case/hex_literal_preserve.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Preserve
fn main() {
let h1 = 0xcAfE_5Ea7;
let h2 = 0xCaFe_F00du32;
let h3 = -0xcAfE_5Ea7;
let h4 = -0xCaFe_F00di32;
let h5 = 0xAbcd07_i32;
let h6 = -0xAbcd07_i32;
}
9 changes: 9 additions & 0 deletions tests/target/configs/hex_literal_case/hex_literal_upper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hex_literal_case: Upper
fn main() {
let h1 = 0xCAFE_5EA7;
let h2 = 0xCAFE_F00Du32;
let h3 = -0xCAFE_5EA7;
let h4 = -0xCAFE_F00Di32;
let h5 = 0xABCD07_i32;
let h6 = -0xABCD07_i32;
}
5 changes: 0 additions & 5 deletions tests/target/hex_literal_lower.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/target/hex_literal_preserve.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tests/target/hex_literal_upper.rs

This file was deleted.

Loading