Auto merge of #66252 - cjgillot:trees, r=oli-obk
Merge repeated definitions Step forward on #66149 I may need further context to understand the need for a separate crate. Also, please tell me if you think of other definitions to merge.
This commit is contained in:
commit
56237d75b4
72 changed files with 298 additions and 404 deletions
|
@ -733,6 +733,30 @@ pub enum Mutability {
|
|||
Immutable,
|
||||
}
|
||||
|
||||
impl Mutability {
|
||||
/// Returns `MutMutable` only if both `self` and `other` are mutable.
|
||||
pub fn and(self, other: Self) -> Self {
|
||||
match self {
|
||||
Mutability::Mutable => other,
|
||||
Mutability::Immutable => Mutability::Immutable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn invert(self) -> Self {
|
||||
match self {
|
||||
Mutability::Mutable => Mutability::Immutable,
|
||||
Mutability::Immutable => Mutability::Mutable,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prefix_str(&self) -> &'static str {
|
||||
match self {
|
||||
Mutability::Mutable => "mut ",
|
||||
Mutability::Immutable => "",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||
pub enum BinOpKind {
|
||||
/// The `+` operator (addition)
|
||||
|
@ -1315,10 +1339,14 @@ pub enum CaptureBy {
|
|||
Ref,
|
||||
}
|
||||
|
||||
/// The movability of a generator / closure literal.
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||
/// The movability of a generator / closure literal:
|
||||
/// whether a generator contains self-references, causing it to be `!Unpin`.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
|
||||
RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||
pub enum Movability {
|
||||
/// May contain self-references, `!Unpin`.
|
||||
Static,
|
||||
/// Must not contain self-references, `Unpin`.
|
||||
Movable,
|
||||
}
|
||||
|
||||
|
@ -1967,12 +1995,34 @@ pub enum IsAuto {
|
|||
No,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
|
||||
RustcEncodable, RustcDecodable, Debug)]
|
||||
pub enum Unsafety {
|
||||
Unsafe,
|
||||
Normal,
|
||||
}
|
||||
|
||||
impl Unsafety {
|
||||
pub fn prefix_str(&self) -> &'static str {
|
||||
match self {
|
||||
Unsafety::Unsafe => "unsafe ",
|
||||
Unsafety::Normal => "",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Unsafety {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(
|
||||
match *self {
|
||||
Unsafety::Normal => "normal",
|
||||
Unsafety::Unsafe => "unsafe",
|
||||
},
|
||||
f,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||
pub enum IsAsync {
|
||||
Async {
|
||||
|
@ -2017,18 +2067,6 @@ pub enum Defaultness {
|
|||
Final,
|
||||
}
|
||||
|
||||
impl fmt::Display for Unsafety {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(
|
||||
match *self {
|
||||
Unsafety::Normal => "normal",
|
||||
Unsafety::Unsafe => "unsafe",
|
||||
},
|
||||
f,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||
pub enum ImplPolarity {
|
||||
/// `impl Trait for Type`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue