Skip to content

Prefer constant over function - #74587

Merged
bors merged 1 commit into
rust-lang:masterfrom
tesuji:consts
Jul 23, 2020
Merged

Prefer constant over function#74587
bors merged 1 commit into
rust-lang:masterfrom
tesuji:consts

Conversation

@tesuji

@tesujitesuji commented Jul 21, 2020

Copy link
Copy Markdown
Contributor

Just that I prefer constants over functions that can be made const.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @dtolnay

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2020
@dtolnaydtolnay added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jul 21, 2020
@dtolnay

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Jul 21, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit e96230d has been approved by dtolnay

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 21, 2020
@tesuji

Copy link
Copy Markdown
ContributorAuthor

@bors rollup=always

@bors

bors commented Jul 22, 2020

Copy link
Copy Markdown
Collaborator

@lzutao: 🔑 Insufficient privileges: not in try users

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 22, 2020
Prefer constant over function
Just that I prefer constants over functions that can be made const.
@Manishearth

Copy link
Copy Markdown
Member

@bors r-

#74647 (comment)

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 22, 2020
@dtolnay

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Jul 23, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 0de7fad has been approved by dtolnay

@bors

bors commented Jul 23, 2020

Copy link
Copy Markdown
Collaborator

🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 23, 2020
#[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;

Copy link
Copy Markdown
ContributorAuthor

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?

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 23, 2020
…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
@bors
bors merged commit bea2eed into rust-lang:masterJul 23, 2020
@tesuji
tesuji deleted the consts branch July 23, 2020 10:56
@cuvipercuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@tesuji@rust-highfive@dtolnay@bors@Manishearth@cuviper