Skip to content

Commit 6a9972f

Browse files
committed
style: Remove use of legacy numeric constants
Cargo clippy reports: ``` warning: usage of a legacy numeric method --> prost/src/lib.rs:71:24 | 71 | if length > usize::max_value() as u64 { | ^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants help: use the associated constant instead | 71 | if length > usize::MAX as u64 { | ~~~ ```
1 parent ba77654 commit 6a9972f

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

prost-types/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ mod protobuf;
2222

2323
use core::convert::TryFrom;
2424
use core::fmt;
25-
use core::i32;
26-
use core::i64;
2725
use core::str::FromStr;
2826
use core::time;
2927

prost/src/encoding.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ use alloc::vec::Vec;
1111
use core::cmp::min;
1212
use core::mem;
1313
use core::str;
14-
use core::u32;
15-
use core::usize;
1614

1715
use ::bytes::{Buf, BufMut, Bytes};
1816

@@ -1350,7 +1348,6 @@ mod test {
13501348
use alloc::string::ToString;
13511349
use core::borrow::Borrow;
13521350
use core::fmt::Debug;
1353-
use core::u64;
13541351

13551352
use ::bytes::BytesMut;
13561353
use proptest::{prelude::*, test_runner::TestCaseResult};

prost/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn length_delimiter_len(length: usize) -> usize {
6868
/// delimiter, and typically the buffer should be considered corrupt.
6969
pub fn decode_length_delimiter(mut buf: impl Buf) -> Result<usize, DecodeError> {
7070
let length = decode_varint(&mut buf)?;
71-
if length > usize::max_value() as u64 {
71+
if length > usize::MAX as u64 {
7272
return Err(DecodeError::new(
7373
"length delimiter exceeds maximum usize value",
7474
));

0 commit comments

Comments
 (0)