Skip to content

style: Update doctests for TryFrom<integer> for bool and From<bool> for float#153197

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
sorairolake:change-doctests-style
Mar 1, 2026
Merged

style: Update doctests for TryFrom<integer> for bool and From<bool> for float#153197
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
sorairolake:change-doctests-style

Conversation

@sorairolake
Copy link
Contributor

@sorairolake sorairolake commented Feb 27, 2026

These doctests are attached to the TryFrom trait and the From trait. Although From<U> for T implies Into<T> for U and TryFrom<U> for T implies TryInto<T> for U, I think it is easier to understand to use the try_from/from method directly instead of the try_into/into method.

These doctests are attached to the `TryFrom` trait. Therefore, it is
easier to understand to use the `try_from` method instead of the
`try_into` method.
These doctests are attached to the `From` trait. Therefore, it is
easier to understand to use the `from` method instead of the `into`
method.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 27, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, joboet, scottmcm

@joboet
Copy link
Member

joboet commented Feb 28, 2026

Yeah, that makes much more sense!
@bors r+ rollup
r? joboet

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 28, 2026

📌 Commit af35716 has been approved by joboet

It is now in the queue for this repository.

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 28, 2026
@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 28, 2026
… r=joboet

style: Update doctests for `TryFrom<integer> for bool` and `From<bool> for float`

These doctests are attached to the `TryFrom` trait and the `From` trait. Although `From<U> for T` implies `Into<T> for U` and `TryFrom<U> for T` implies `TryInto<T> for U`, I think it is easier to understand to use the `try_from`/`from` method directly instead of the `try_into`/`into` method.
rust-bors bot pushed a commit that referenced this pull request Feb 28, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #146989 (Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).)
 - #151991 (std: sys: pal: uefi: os: Implement split_paths)
 - #152794 (Fix ICE in `try_to_raw_bytes` when array elements have mismatched)
 - #153052 (std random.rs: update link to RTEMS docs)
 - #153054 (docs: note env var influence on `temp_dir` and `env_clear` on Windows)
 - #153061 (cleanup `tests/ui/box`, part 2)
 - #153197 (style: Update doctests for `TryFrom<integer> for bool` and `From<bool> for float`)
 - #153210 (Fix ICE on empty file with -Zquery-dep-graph)
 - #153228 (Remove `TranslationError`)
@rust-bors rust-bors bot merged commit d94d079 into rust-lang:main Mar 1, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 1, 2026
rust-timer added a commit that referenced this pull request Mar 1, 2026
Rollup merge of #153197 - sorairolake:change-doctests-style, r=joboet

style: Update doctests for `TryFrom<integer> for bool` and `From<bool> for float`

These doctests are attached to the `TryFrom` trait and the `From` trait. Although `From<U> for T` implies `Into<T> for U` and `TryFrom<U> for T` implies `TryInto<T> for U`, I think it is easier to understand to use the `try_from`/`from` method directly instead of the `try_into`/`into` method.
@sorairolake sorairolake deleted the change-doctests-style branch March 1, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant 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.

4 participants