Skip to content

Move numeric consts to associated consts #67913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use cmp::min instead of manual if-else
Co-Authored-By: lzutao <taolzu@gmail.com>
  • Loading branch information
faern and tesuji committed Jan 6, 2020
commit ab389e5ed8e1b0389fc1ce86e168d6e145b65cdb
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TIMESPEC_MAX: libc::timespec =
libc::timespec { tv_sec: <libc::time_t>::MAX, tv_nsec: 1_000_000_000 - 1 };

fn saturating_cast_to_time_t(value: u64) -> libc::time_t {
if value > <libc::time_t>::MAX as u64 { <libc::time_t>::MAX } else { value as libc::time_t }
crate::cmp::min(value, libc::time_t::MAX as u64) as _
}

impl Condvar {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/vxworks/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TIMESPEC_MAX: libc::timespec =
libc::timespec { tv_sec: <libc::time_t>::MAX, tv_nsec: 1_000_000_000 - 1 };

fn saturating_cast_to_time_t(value: u64) -> libc::time_t {
if value > <libc::time_t>::MAX as u64 { <libc::time_t>::MAX } else { value as libc::time_t }
crate::cmp::min(value, libc::time_t::MAX as u64) as _
}

impl Condvar {
Expand Down