Skip to content

Commit 49d4a75

Browse files
committed
Remove unused code from rustc_ast
1 parent d7791f4 commit 49d4a75

File tree

5 files changed

+0
-64
lines changed

5 files changed

+0
-64
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ pub enum GenericArgs {
167167
}
168168

169169
impl GenericArgs {
170-
pub fn is_parenthesized(&self) -> bool {
171-
match *self {
172-
Parenthesized(..) => true,
173-
_ => false,
174-
}
175-
}
176-
177170
pub fn is_angle_bracketed(&self) -> bool {
178171
match *self {
179172
AngleBracketed(..) => true,
@@ -857,13 +850,6 @@ impl BinOpKind {
857850
}
858851
}
859852

860-
pub fn is_shift(&self) -> bool {
861-
match *self {
862-
BinOpKind::Shl | BinOpKind::Shr => true,
863-
_ => false,
864-
}
865-
}
866-
867853
pub fn is_comparison(&self) -> bool {
868854
use BinOpKind::*;
869855
// Note for developers: please keep this as is;
@@ -873,11 +859,6 @@ impl BinOpKind {
873859
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
874860
}
875861
}
876-
877-
/// Returns `true` if the binary operator takes its arguments by value
878-
pub fn is_by_value(&self) -> bool {
879-
!self.is_comparison()
880-
}
881862
}
882863

883864
pub type BinOp = Spanned<BinOpKind>;
@@ -896,14 +877,6 @@ pub enum UnOp {
896877
}
897878

898879
impl UnOp {
899-
/// Returns `true` if the unary operator takes its argument by value
900-
pub fn is_by_value(u: UnOp) -> bool {
901-
match u {
902-
UnOp::Neg | UnOp::Not => true,
903-
_ => false,
904-
}
905-
}
906-
907880
pub fn to_string(op: UnOp) -> &'static str {
908881
match op {
909882
UnOp::Deref => "*",
@@ -1753,13 +1726,6 @@ impl IntTy {
17531726
}
17541727
}
17551728

1756-
pub fn val_to_string(&self, val: i128) -> String {
1757-
// Cast to a `u128` so we can correctly print `INT128_MIN`. All integral types
1758-
// are parsed as `u128`, so we wouldn't want to print an extra negative
1759-
// sign.
1760-
format!("{}{}", val as u128, self.name_str())
1761-
}
1762-
17631729
pub fn bit_width(&self) -> Option<u64> {
17641730
Some(match *self {
17651731
IntTy::Isize => return None,
@@ -1818,10 +1784,6 @@ impl UintTy {
18181784
}
18191785
}
18201786

1821-
pub fn val_to_string(&self, val: u128) -> String {
1822-
format!("{}{}", val, self.name_str())
1823-
}
1824-
18251787
pub fn bit_width(&self) -> Option<u64> {
18261788
Some(match *self {
18271789
UintTy::Usize => return None,

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ impl NestedMetaItem {
101101
self.meta_item().is_some()
102102
}
103103

104-
/// Returns `true` if the variant is `Literal`.
105-
pub fn is_literal(&self) -> bool {
106-
self.literal().is_some()
107-
}
108-
109104
/// Returns `true` if `self` is a `MetaItem` and the meta item is a word.
110105
pub fn is_word(&self) -> bool {
111106
self.meta_item().map_or(false, |meta_item| meta_item.is_word())
@@ -232,10 +227,6 @@ impl MetaItem {
232227
pub fn is_value_str(&self) -> bool {
233228
self.value_str().is_some()
234229
}
235-
236-
pub fn is_meta_item_list(&self) -> bool {
237-
self.meta_item_list().is_some()
238-
}
239230
}
240231

241232
impl AttrItem {

compiler/rustc_ast/src/token.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ pub enum DelimToken {
5454
NoDelim,
5555
}
5656

57-
impl DelimToken {
58-
pub fn len(self) -> usize {
59-
if self == NoDelim { 0 } else { 1 }
60-
}
61-
62-
pub fn is_empty(self) -> bool {
63-
self == NoDelim
64-
}
65-
}
66-
6757
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
6858
pub enum LitKind {
6959
Bool, // AST only, must never appear in a `Token`

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,6 @@ impl TokenStream {
295295
.collect(),
296296
))
297297
}
298-
299-
pub fn map<F: FnMut(TokenTree) -> TokenTree>(self, mut f: F) -> TokenStream {
300-
TokenStream(Lrc::new(
301-
self.0.iter().map(|(tree, is_joint)| (f(tree.clone()), *is_joint)).collect(),
302-
))
303-
}
304298
}
305299

306300
// 99.5%+ of the time we have 1 or 2 elements in this vector.

compiler/rustc_ast/src/util/parser.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ impl AssocOp {
231231
}
232232
}
233233

234-
pub const PREC_RESET: i8 = -100;
235234
pub const PREC_CLOSURE: i8 = -40;
236235
pub const PREC_JUMP: i8 = -30;
237236
pub const PREC_RANGE: i8 = -10;

0 commit comments

Comments
 (0)