Skip to content

Commit

Permalink
Auto merge of #8077 - faern:use-assoc-int-consts, r=ehuss
Browse files Browse the repository at this point in the history
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 :)
  • Loading branch information
bors committed Apr 28, 2020
2 parents a0a14f2 + c428c0e commit 90931d9
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::str;
use std::time::{self, Duration};
use std::usize;

use cargo::util::{is_ci, CargoResult, ProcessBuilder, ProcessError, Rustc};
use serde_json::{self, Value};
Expand Down
2 changes: 1 addition & 1 deletion crates/resolver-tests/tests/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ proptest! {
0
} else {
// but that local builds will give a small clear test case.
std::u32::MAX
u32::MAX
},
result_cache: prop::test_runner::basic_result_cache,
.. ProptestConfig::default()
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/conflict_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl ConflictCache {
dep: &Dependency,
must_contain: Option<PackageId>,
) -> Option<&ConflictMap> {
let out = self.find(dep, &|id| cx.is_active(id), must_contain, std::usize::MAX);
let out = self.find(dep, &|id| cx.is_active(id), must_contain, usize::MAX);
if cfg!(debug_assertions) {
if let Some(c) = &out {
assert!(cx.is_conflicting(None, c).is_some());
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fn lib_nostd() {
r#"
#![no_std]
pub fn foo() {
assert_eq!(core::u8::MIN, 0);
assert_eq!(u8::MIN, 0);
}
"#,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn cargo_test_overflow_checks() {
use std::panic;
pub fn main() {
let r = panic::catch_unwind(|| {
[1, i32::max_value()].iter().sum::<i32>();
[1, i32::MAX].iter().sum::<i32>();
});
assert!(r.is_err());
}"#,
Expand Down

0 comments on commit 90931d9

Please sign in to comment.