Make cow_is_borrowed
methods const
Constify the following methods of `alloc::borrow::Cow`: - `is_borrowed` - `is_owned` These methods are still unstable under `cow_is_borrowed`. Possible because of #49146 (Allow if and match in constants). Tracking issue: #65143
This commit is contained in:
parent
36b0d7e257
commit
af24bdbd96
@ -217,7 +217,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
|
||||
/// assert!(!bull.is_borrowed());
|
||||
/// ```
|
||||
#[unstable(feature = "cow_is_borrowed", issue = "65143")]
|
||||
pub fn is_borrowed(&self) -> bool {
|
||||
pub const fn is_borrowed(&self) -> bool {
|
||||
match *self {
|
||||
Borrowed(_) => true,
|
||||
Owned(_) => false,
|
||||
@ -239,7 +239,7 @@ pub fn is_borrowed(&self) -> bool {
|
||||
/// assert!(!bull.is_owned());
|
||||
/// ```
|
||||
#[unstable(feature = "cow_is_borrowed", issue = "65143")]
|
||||
pub fn is_owned(&self) -> bool {
|
||||
pub const fn is_owned(&self) -> bool {
|
||||
!self.is_borrowed()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user