style: Update doctests for TryFrom<integer> for bool and From<bool> for float#153197
Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom Mar 1, 2026
Merged
Conversation
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.
Collaborator
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
Yeah, that makes much more sense! |
Contributor
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.
This was referenced Feb 28, 2026
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-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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These doctests are attached to the
TryFromtrait and theFromtrait. AlthoughFrom<U> for TimpliesInto<T> for UandTryFrom<U> for TimpliesTryInto<T> for U, I think it is easier to understand to use thetry_from/frommethod directly instead of thetry_into/intomethod.