Skip to content

Commit

Permalink
fixup! docs: Improve AsRef / AsMut docs on blanket impls
Browse files Browse the repository at this point in the history
Changed wording in sections on "Reflexivity":
replaced "that is there is" with "i.e. there would be" and removed comma
before "with"

Reason: "there is" somewhat contradicted the "would be" hypothetical.
A slightly redundant wording has now been chosen for better clarity.
The comma seemed to be superfluous.
  • Loading branch information
JanBeh committed Jul 21, 2022
1 parent e4a259b commit e6b761b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ pub const fn identity<T>(x: T) -> T {
///
/// # Reflexivity
///
/// Ideally, `AsRef` would be reflexive, that is there is an `impl<T: ?Sized> AsRef<T> for T`, with
/// [`as_ref`] simply returning its argument unchanged.
/// Ideally, `AsRef` would be reflexive, i.e. there would be an `impl<T: ?Sized> AsRef<T> for T`
/// with [`as_ref`] simply returning its argument unchanged.
/// Such a blanket implementation is currently *not* provided due to technical restrictions of
/// Rust's type system (it would be overlapping with another existing blanket implementation for
/// `&T where T: AsRef<U>` which allows `AsRef` to auto-dereference, see "Generic Implementations"
Expand Down Expand Up @@ -283,8 +283,8 @@ pub trait AsRef<T: ?Sized> {
///
/// # Reflexivity
///
/// Ideally, `AsMut` would be reflexive, that is there is an `impl<T: ?Sized> AsMut<T> for T`, with
/// [`as_mut`] simply returning its argument unchanged.
/// Ideally, `AsMut` would be reflexive, i.e. there would be an `impl<T: ?Sized> AsMut<T> for T`
/// with [`as_mut`] simply returning its argument unchanged.
/// Such a blanket implementation is currently *not* provided due to technical restrictions of
/// Rust's type system (it would be overlapping with another existing blanket implementation for
/// `&mut T where T: AsMut<U>` which allows `AsMut` to auto-dereference, see "Generic
Expand Down

0 comments on commit e6b761b

Please sign in to comment.