diff --git a/library/core/src/ub_checks.rs b/library/core/src/ub_checks.rs index faf08abdc2424..ae24b32e28d21 100644 --- a/library/core/src/ub_checks.rs +++ b/library/core/src/ub_checks.rs @@ -163,7 +163,7 @@ pub(crate) const fn is_nonoverlapping( pub use predicates::*; -pub(crate) trait MetadataPredicates where T: ?Sized { +pub trait MetadataPredicates where T: ?Sized { /// If the metadata is the length of a slice or str, run the map function. fn map_len(metadata: *const Self, map: F) -> Option where @@ -193,7 +193,10 @@ impl MetadataPredicates for () { } } -impl MetadataPredicates for usize where T: ?Sized{ +impl MetadataPredicates for usize +where + T: ?Sized +{ /// Return the result of the map function. fn map_len(metadata: *const Self, map: F) -> Option where @@ -211,7 +214,10 @@ impl MetadataPredicates for usize where T: ?Sized{ } } -impl MetadataPredicates for crate::ptr::DynMetadata where T: ?Sized { +impl MetadataPredicates for crate::ptr::DynMetadata +where + T: ?Sized +{ /// Not a length. Return None. fn map_len(_metadata: *const Self, _map: F) -> Option where @@ -225,7 +231,7 @@ impl MetadataPredicates for crate::ptr::DynMetadata where T: ?Sized { where F: Fn(*const crate::ptr::DynMetadata) -> U, { - Some(map(metadata)) + Some(map(metadata)) } }