Skip to content

Commit 90931d9

Browse files
committed
Auto merge of #8077 - faern:use-assoc-int-consts, r=ehuss
Use associated constants directly on primitive types instead of modules This PR is in no way critical. It's more of a code cleanup. It comes as a result of me making rust-lang/rust#70857 and search-and-replacing all usage of the soft-deprecated ways of reaching primitive type constants. It makes the code slightly shorter, that's basically it. And showcases the recommended way of reaching these consts on new code :)
2 parents a0a14f2 + c428c0e commit 90931d9

File tree

5 files changed

+4
-5
lines changed

5 files changed

+4
-5
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ use std::path::{Path, PathBuf};
117117
use std::process::{Command, Output};
118118
use std::str;
119119
use std::time::{self, Duration};
120-
use std::usize;
121120

122121
use cargo::util::{is_ci, CargoResult, ProcessBuilder, ProcessError, Rustc};
123122
use serde_json::{self, Value};

crates/resolver-tests/tests/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ proptest! {
2525
0
2626
} else {
2727
// but that local builds will give a small clear test case.
28-
std::u32::MAX
28+
u32::MAX
2929
},
3030
result_cache: prop::test_runner::basic_result_cache,
3131
.. ProptestConfig::default()

src/cargo/core/resolver/conflict_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl ConflictCache {
175175
dep: &Dependency,
176176
must_contain: Option<PackageId>,
177177
) -> Option<&ConflictMap> {
178-
let out = self.find(dep, &|id| cx.is_active(id), must_contain, std::usize::MAX);
178+
let out = self.find(dep, &|id| cx.is_active(id), must_contain, usize::MAX);
179179
if cfg!(debug_assertions) {
180180
if let Some(c) = &out {
181181
assert!(cx.is_conflicting(None, c).is_some());

tests/testsuite/standard_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn lib_nostd() {
303303
r#"
304304
#![no_std]
305305
pub fn foo() {
306-
assert_eq!(core::u8::MIN, 0);
306+
assert_eq!(u8::MIN, 0);
307307
}
308308
"#,
309309
)

tests/testsuite/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn cargo_test_overflow_checks() {
129129
use std::panic;
130130
pub fn main() {
131131
let r = panic::catch_unwind(|| {
132-
[1, i32::max_value()].iter().sum::<i32>();
132+
[1, i32::MAX].iter().sum::<i32>();
133133
});
134134
assert!(r.is_err());
135135
}"#,

0 commit comments

Comments
 (0)