Remove unused code from rustc_ast
This commit is contained in:
parent
d7791f485b
commit
49d4a756f1
5 changed files with 0 additions and 64 deletions
|
@ -167,13 +167,6 @@ pub enum GenericArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenericArgs {
|
impl GenericArgs {
|
||||||
pub fn is_parenthesized(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
Parenthesized(..) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_angle_bracketed(&self) -> bool {
|
pub fn is_angle_bracketed(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
AngleBracketed(..) => true,
|
AngleBracketed(..) => true,
|
||||||
|
@ -857,13 +850,6 @@ impl BinOpKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_shift(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
BinOpKind::Shl | BinOpKind::Shr => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_comparison(&self) -> bool {
|
pub fn is_comparison(&self) -> bool {
|
||||||
use BinOpKind::*;
|
use BinOpKind::*;
|
||||||
// Note for developers: please keep this as is;
|
// Note for developers: please keep this as is;
|
||||||
|
@ -873,11 +859,6 @@ impl BinOpKind {
|
||||||
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
|
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the binary operator takes its arguments by value
|
|
||||||
pub fn is_by_value(&self) -> bool {
|
|
||||||
!self.is_comparison()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type BinOp = Spanned<BinOpKind>;
|
pub type BinOp = Spanned<BinOpKind>;
|
||||||
|
@ -896,14 +877,6 @@ pub enum UnOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnOp {
|
impl UnOp {
|
||||||
/// Returns `true` if the unary operator takes its argument by value
|
|
||||||
pub fn is_by_value(u: UnOp) -> bool {
|
|
||||||
match u {
|
|
||||||
UnOp::Neg | UnOp::Not => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_string(op: UnOp) -> &'static str {
|
pub fn to_string(op: UnOp) -> &'static str {
|
||||||
match op {
|
match op {
|
||||||
UnOp::Deref => "*",
|
UnOp::Deref => "*",
|
||||||
|
@ -1753,13 +1726,6 @@ impl IntTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn val_to_string(&self, val: i128) -> String {
|
|
||||||
// Cast to a `u128` so we can correctly print `INT128_MIN`. All integral types
|
|
||||||
// are parsed as `u128`, so we wouldn't want to print an extra negative
|
|
||||||
// sign.
|
|
||||||
format!("{}{}", val as u128, self.name_str())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bit_width(&self) -> Option<u64> {
|
pub fn bit_width(&self) -> Option<u64> {
|
||||||
Some(match *self {
|
Some(match *self {
|
||||||
IntTy::Isize => return None,
|
IntTy::Isize => return None,
|
||||||
|
@ -1818,10 +1784,6 @@ impl UintTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn val_to_string(&self, val: u128) -> String {
|
|
||||||
format!("{}{}", val, self.name_str())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bit_width(&self) -> Option<u64> {
|
pub fn bit_width(&self) -> Option<u64> {
|
||||||
Some(match *self {
|
Some(match *self {
|
||||||
UintTy::Usize => return None,
|
UintTy::Usize => return None,
|
||||||
|
|
|
@ -101,11 +101,6 @@ impl NestedMetaItem {
|
||||||
self.meta_item().is_some()
|
self.meta_item().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the variant is `Literal`.
|
|
||||||
pub fn is_literal(&self) -> bool {
|
|
||||||
self.literal().is_some()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
|
/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
|
||||||
pub fn is_word(&self) -> bool {
|
pub fn is_word(&self) -> bool {
|
||||||
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
|
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
|
||||||
|
@ -232,10 +227,6 @@ impl MetaItem {
|
||||||
pub fn is_value_str(&self) -> bool {
|
pub fn is_value_str(&self) -> bool {
|
||||||
self.value_str().is_some()
|
self.value_str().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_meta_item_list(&self) -> bool {
|
|
||||||
self.meta_item_list().is_some()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AttrItem {
|
impl AttrItem {
|
||||||
|
|
|
@ -54,16 +54,6 @@ pub enum DelimToken {
|
||||||
NoDelim,
|
NoDelim,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DelimToken {
|
|
||||||
pub fn len(self) -> usize {
|
|
||||||
if self == NoDelim { 0 } else { 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_empty(self) -> bool {
|
|
||||||
self == NoDelim
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
|
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
|
||||||
pub enum LitKind {
|
pub enum LitKind {
|
||||||
Bool, // AST only, must never appear in a `Token`
|
Bool, // AST only, must never appear in a `Token`
|
||||||
|
|
|
@ -295,12 +295,6 @@ impl TokenStream {
|
||||||
.collect(),
|
.collect(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, mut f: F) -> TokenStream {
|
|
||||||
TokenStream(Lrc::new(
|
|
||||||
self.0.iter().map(|(tree, is_joint)| (f(tree.clone()), *is_joint)).collect(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 99.5%+ of the time we have 1 or 2 elements in this vector.
|
// 99.5%+ of the time we have 1 or 2 elements in this vector.
|
||||||
|
|
|
@ -231,7 +231,6 @@ impl AssocOp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const PREC_RESET: i8 = -100;
|
|
||||||
pub const PREC_CLOSURE: i8 = -40;
|
pub const PREC_CLOSURE: i8 = -40;
|
||||||
pub const PREC_JUMP: i8 = -30;
|
pub const PREC_JUMP: i8 = -30;
|
||||||
pub const PREC_RANGE: i8 = -10;
|
pub const PREC_RANGE: i8 = -10;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue