-
Notifications
You must be signed in to change notification settings - Fork 13.7k
formatting_options: Make all methods const
#145863
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
formatting_options: Make all methods const
#145863
Conversation
This comment has been minimized.
This comment has been minimized.
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.
Please remove the username mention from the commit message (just dropping the @
is fine).
Having `const fn`s that take a `mut &` was unstable until Rust 1.83. Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`. Thanks to Ternvein for bringing this to my attention (see [1]). [1]: rust-lang#118117 (comment)
89c3389
to
575a90e
Compare
@jieyouxu Done (also removed the mentioned PR ID). Sorry, didn't check this PR after creating it because I thought the CI would take a while anyway. |
No worries, that's completely fine. This is why there's an automated warning message 😁 |
@bors r+ rollup |
Rollup of 11 pull requests Successful merges: - #144373 (remove deprecated Error::description in impls) - #144551 (Add aarch64_be-unknown-linux-musl target) - #145076 (Add new Tier-3 target: riscv64a23-unknown-linux-gnu) - #145481 (Add parentheses for closure when suggesting calling closure) - #145596 (Losslessly optimize PNG files) - #145615 (Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`) - #145841 (Always build miri for the host in `x run miri`) - #145861 (bootstrap: vendor `clippy_test_deps` too) - #145863 (formatting_options: Make all methods `const`) - #145867 (cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits) - #145875 (Make bootstrap command caching opt-in) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145863 - EliasHolzmann:formatting_options_20250825, r=m-ou-se formatting_options: Make all methods `const` Related to #118117. Having `const fn`s that take a `mut &` was unstable until Rust 1.83 (see #129195). Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`. Thanks to `@Ternvein` for bringing this to my attention (see [1]). r? `@m-ou-se` (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested) [1]: #118117 (comment)
Related to #118117.
Having
const fn
s that take amut &
was unstable until Rust 1.83 (see #129195). Because of this, not all methods onFormattingOptions
were implemented asconst
. As this has been stabilized now, there is no reason not to have all methodsconst
.Thanks to @Ternvein for bringing this to my attention (see 1).
r? @m-ou-se (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested)