Skip to content

Commit 019578f

Browse files
Rawkytmimi
authored andcommitted
Use usize::MAX instead of deprecated usize::max_value
1 parent 5230e8f commit 019578f

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Diff for: src/config/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,10 @@ make_backup = false
10491049
max_width = 100
10501050
"#;
10511051
let config = Config::from_toml(toml, Path::new("./rustfmt.toml")).unwrap();
1052-
assert_eq!(config.array_width(), usize::max_value());
1053-
assert_eq!(config.attr_fn_like_width(), usize::max_value());
1054-
assert_eq!(config.chain_width(), usize::max_value());
1055-
assert_eq!(config.fn_call_width(), usize::max_value());
1052+
assert_eq!(config.array_width(), usize::MAX);
1053+
assert_eq!(config.attr_fn_like_width(), usize::MAX);
1054+
assert_eq!(config.chain_width(), usize::MAX);
1055+
assert_eq!(config.fn_call_width(), usize::MAX);
10561056
assert_eq!(config.single_line_if_else_max_width(), 0);
10571057
assert_eq!(config.struct_lit_width(), 0);
10581058
assert_eq!(config.struct_variant_width(), 0);

Diff for: src/config/options.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ impl WidthHeuristics {
255255
// Using this WidthHeuristics means we ignore heuristics.
256256
pub fn null() -> WidthHeuristics {
257257
WidthHeuristics {
258-
fn_call_width: usize::max_value(),
259-
attr_fn_like_width: usize::max_value(),
258+
fn_call_width: usize::MAX,
259+
attr_fn_like_width: usize::MAX,
260260
struct_lit_width: 0,
261261
struct_variant_width: 0,
262-
array_width: usize::max_value(),
263-
chain_width: usize::max_value(),
262+
array_width: usize::MAX,
263+
chain_width: usize::MAX,
264264
single_line_if_else_max_width: 0,
265265
single_line_let_else_max_width: 0,
266266
}

Diff for: src/macros.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1163,9 +1163,9 @@ pub(crate) fn convert_try_mac(
11631163

11641164
pub(crate) fn macro_style(mac: &ast::MacCall, context: &RewriteContext<'_>) -> Delimiter {
11651165
let snippet = context.snippet(mac.span());
1166-
let paren_pos = snippet.find_uncommented("(").unwrap_or(usize::max_value());
1167-
let bracket_pos = snippet.find_uncommented("[").unwrap_or(usize::max_value());
1168-
let brace_pos = snippet.find_uncommented("{").unwrap_or(usize::max_value());
1166+
let paren_pos = snippet.find_uncommented("(").unwrap_or(usize::MAX);
1167+
let bracket_pos = snippet.find_uncommented("[").unwrap_or(usize::MAX);
1168+
let brace_pos = snippet.find_uncommented("{").unwrap_or(usize::MAX);
11691169

11701170
if paren_pos < bracket_pos && paren_pos < brace_pos {
11711171
Delimiter::Parenthesis

Diff for: src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub(crate) fn rewrite_string<'a>(
8484
stripped_str
8585
.len()
8686
.checked_next_power_of_two()
87-
.unwrap_or(usize::max_value()),
87+
.unwrap_or(usize::MAX),
8888
);
8989
result.push_str(fmt.opener);
9090

0 commit comments

Comments
 (0)