-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Mark std::fmt::from_fn
as #[must_use]
#136502
Conversation
I think this is fine but it should get an ack from the api team r? libs-api
This should be simple enough to figure out now, maybe something along the lines of "result does nothing unless used in a formatter". |
"returns a type implementing Debug and Display, which do not have any effects unless they are used". |
I think burntsushi has been taking a break from reviews r? libs-api |
Maybe "in a formatting operation"? |
I like that one.. |
The need to avoid "formatter" or "formatting operation" becomes obvious considering you could just call |
0474182
to
6b016d7
Compare
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.
Thank you!
@bors r+ rollup |
… r=dtolnay Mark `std::fmt::from_fn` as `#[must_use]` While working on rust-lang#135494 I managed to shoot my own foot a few times by forgetting to actually use the result of `fmt::from_fn`, so I think a `#[must_use]` could be appropriate! Didn't have a good message to put in the attr so left it blank, still unstable so we can come back to it I guess? cc rust-lang#117729 (and a huge +1 for getting it stabilized, it's very useful IMHO)
Rollup of 9 pull requests Successful merges: - rust-lang#128045 (#[contracts::requires(...)] + #[contracts::ensures(...)]) - rust-lang#136263 (rustdoc: clean up a bunch of ts-expected-error declarations in main) - rust-lang#136375 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 1)) - rust-lang#136392 (bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros) - rust-lang#136405 (rustdoc-book: Clean up section on `--output-format`) - rust-lang#136497 (Report generic mismatches when calling bodyless trait functions) - rust-lang#136502 (Mark `std::fmt::from_fn` as `#[must_use]`) - rust-lang#136509 (Add tests for nested macro_rules edition behavior) - rust-lang#136526 (mir_build: Rename `thir::cx::Cx` to `ThirBuildCx` and remove `UserAnnotatedTyHelpers`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang#128045 (#[contracts::requires(...)] + #[contracts::ensures(...)]) - rust-lang#136263 (rustdoc: clean up a bunch of ts-expected-error declarations in main) - rust-lang#136375 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 1)) - rust-lang#136392 (bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros) - rust-lang#136396 (rustdoc-json-types: Document that crate name isn't package name.) - rust-lang#136405 (rustdoc-book: Clean up section on `--output-format`) - rust-lang#136502 (Mark `std::fmt::from_fn` as `#[must_use]`) - rust-lang#136509 (Add tests for nested macro_rules edition behavior) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136502 - yotamofek:pr/fmt-from-fn-must-use, r=dtolnay Mark `std::fmt::from_fn` as `#[must_use]` While working on rust-lang#135494 I managed to shoot my own foot a few times by forgetting to actually use the result of `fmt::from_fn`, so I think a `#[must_use]` could be appropriate! Didn't have a good message to put in the attr so left it blank, still unstable so we can come back to it I guess? cc rust-lang#117729 (and a huge +1 for getting it stabilized, it's very useful IMHO)
While working on #135494 I managed to shoot my own foot a few times by forgetting to actually use the result of
fmt::from_fn
, so I think a#[must_use]
could be appropriate!Didn't have a good message to put in the attr so left it blank, still unstable so we can come back to it I guess?
cc #117729 (and a huge +1 for getting it stabilized, it's very useful IMHO)