-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Prefer constant over function #74587
Conversation
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit e96230d has been approved by |
@bors rollup=always |
@lzutao: 🔑 Insufficient privileges: not in try users |
Prefer constant over function Just that I prefer constants over functions that can be made const.
@bors r+ |
📌 Commit 0de7fad has been approved by |
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
#[cfg(target_os = "macos")] | ||
const READ_LIMIT: usize = c_int::MAX as usize - 1; | ||
#[cfg(not(target_os = "macos"))] | ||
const READ_LIMIT: usize = libc::ssize_t::MAX as usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder can we use isize::MAX instead?
…arth Rollup of 8 pull requests Successful merges: - rust-lang#74141 (libstd/libcore: fix various typos) - rust-lang#74490 (add a Backtrace::disabled function) - rust-lang#74548 (one more Path::with_extension example, to demonstrate behavior) - rust-lang#74587 (Prefer constant over function) - rust-lang#74606 (Remove Linux workarounds for missing CLOEXEC support) - rust-lang#74637 (Make str point to primitive page) - rust-lang#74654 (require type defaults to be after const generic parameters) - rust-lang#74659 (Improve codegen for unchecked float casts on wasm) Failed merges: r? @ghost
Just that I prefer constants over functions that can be made const.