Skip to content

Commit

Permalink
Use usize::MAX instead of deprecated usize::max_value
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawk authored and ytmimi committed Sep 17, 2024
1 parent 5230e8f commit 019578f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,10 +1049,10 @@ make_backup = false
max_width = 100
"#;
let config = Config::from_toml(toml, Path::new("./rustfmt.toml")).unwrap();
assert_eq!(config.array_width(), usize::max_value());
assert_eq!(config.attr_fn_like_width(), usize::max_value());
assert_eq!(config.chain_width(), usize::max_value());
assert_eq!(config.fn_call_width(), usize::max_value());
assert_eq!(config.array_width(), usize::MAX);
assert_eq!(config.attr_fn_like_width(), usize::MAX);
assert_eq!(config.chain_width(), usize::MAX);
assert_eq!(config.fn_call_width(), usize::MAX);
assert_eq!(config.single_line_if_else_max_width(), 0);
assert_eq!(config.struct_lit_width(), 0);
assert_eq!(config.struct_variant_width(), 0);
Expand Down
8 changes: 4 additions & 4 deletions src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ impl WidthHeuristics {
// Using this WidthHeuristics means we ignore heuristics.
pub fn null() -> WidthHeuristics {
WidthHeuristics {
fn_call_width: usize::max_value(),
attr_fn_like_width: usize::max_value(),
fn_call_width: usize::MAX,
attr_fn_like_width: usize::MAX,
struct_lit_width: 0,
struct_variant_width: 0,
array_width: usize::max_value(),
chain_width: usize::max_value(),
array_width: usize::MAX,
chain_width: usize::MAX,
single_line_if_else_max_width: 0,
single_line_let_else_max_width: 0,
}
Expand Down
6 changes: 3 additions & 3 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,9 +1163,9 @@ pub(crate) fn convert_try_mac(

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

if paren_pos < bracket_pos && paren_pos < brace_pos {
Delimiter::Parenthesis
Expand Down
2 changes: 1 addition & 1 deletion src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub(crate) fn rewrite_string<'a>(
stripped_str
.len()
.checked_next_power_of_two()
.unwrap_or(usize::max_value()),
.unwrap_or(usize::MAX),
);
result.push_str(fmt.opener);

Expand Down

0 comments on commit 019578f

Please sign in to comment.