mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Use usize::MAX
instead of deprecated usize::max_value
This commit is contained in:
parent
5230e8fbe6
commit
019578f924
@ -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);
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user