Skip to content

Commit 71cbb4a

Browse files
elliottttrevor-stripefables-tales
authored
Selectively allow unused fields and trait members for rust-1.83 (#470)
Co-authored-by: Trevor Elliott <trevor@stripe.com> Co-authored-by: Fable Tales <penelope@hey.com>
1 parent d23fbca commit 71cbb4a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

librubyfmt/src/parser_state.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,17 @@ where
124124
fn current_formatting_context(&self) -> FormattingContext;
125125
fn is_absorbing_indents(&self) -> bool;
126126
fn has_comments_in_line(&self, start_line: LineNumber, end_line: LineNumber) -> bool;
127+
128+
#[allow(unused)]
127129
fn current_line_number(&self) -> u64;
128130

129131
// blocks
132+
#[allow(unused)]
130133
fn start_indent(&mut self);
131134
fn start_indent_for_call_chain(&mut self);
135+
#[allow(unused)]
132136
fn end_indent_for_call_chain(&mut self);
137+
#[allow(unused)]
133138
fn end_indent(&mut self);
134139
fn with_formatting_context(&mut self, fc: FormattingContext, f: RenderFunc);
135140
fn new_scope(&mut self, f: RenderFunc);
@@ -153,6 +158,7 @@ where
153158
fn with_suppress_comments(&mut self, suppress: bool, f: RenderFunc);
154159
fn will_render_as_multiline(&mut self, f: RenderFunc) -> bool;
155160

161+
#[allow(unused)]
156162
fn will_render_beyond_max_line_length(&mut self, f: RenderFunc) -> bool;
157163

158164
// stuff to remove from this enum

librubyfmt/src/ripper_tree_types.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ impl Params {
12591259
// we have for some reason.
12601260
#[derive(RipperDeserialize, Debug, Clone)]
12611261
pub enum RestParamOr0OrExcessedComma {
1262+
#[allow(unused)]
12621263
Zero(i64),
12631264
RestParam(RestParam),
12641265
ExcessedComma(ExcessedComma),
@@ -1290,6 +1291,7 @@ impl Params {
12901291
#[allow(clippy::large_enum_variant)]
12911292
pub enum ExpressionOrFalse {
12921293
Expression(Expression),
1294+
#[allow(unused)]
12931295
False(bool),
12941296
}
12951297

@@ -1312,6 +1314,7 @@ def_tag!(blockarg_tag, "blockarg");
13121314
pub struct BlockArg(pub blockarg_tag, pub Option<Ident>);
13131315

13141316
#[derive(Deserialize, Debug, Clone)]
1317+
#[allow(unused)]
13151318
pub struct LineCol(pub LineNumber, pub u64);
13161319

13171320
#[derive(Deserialize, Debug, Clone, Eq, PartialEq)]
@@ -1415,16 +1418,19 @@ pub enum ArgNode {
14151418
Exprs(Vec<Expression>),
14161419
Const(Const),
14171420
Ident(Ident),
1421+
#[allow(unused)]
14181422
Null(Option<String>),
14191423
}
14201424

14211425
def_tag!(arg_paren_tag, "arg_paren");
14221426
#[derive(Deserialize, Debug, Clone)]
1427+
#[allow(unused)]
14231428
pub struct ArgParen(pub arg_paren_tag, pub Box<ArgNode>, pub StartEnd);
14241429

14251430
// See: https://dev.to/penelope_zone/understanding-ruby-s-block-proc-parsing-4a89
14261431
#[derive(RipperDeserialize, Debug, Clone)]
14271432
pub enum ToProcExpr {
1433+
#[allow(unused)]
14281434
NotPresent(bool),
14291435
Present(Box<Expression>),
14301436
}
@@ -1436,12 +1442,13 @@ pub struct ArgsAddBlock(
14361442
pub args_add_block_tag,
14371443
pub ArgsAddBlockInner,
14381444
pub Option<ToProcExpr>,
1439-
pub StartEnd,
1445+
#[allow(unused)] pub StartEnd,
14401446
);
14411447

14421448
#[derive(RipperDeserialize, Debug, Clone)]
14431449
pub enum AABParen {
14441450
Paren((paren_tag, Box<Expression>)),
1451+
#[allow(unused)]
14451452
EmptyParen((paren_tag, bool)),
14461453
Expression(Box<Expression>),
14471454
}
@@ -1945,6 +1952,7 @@ impl DotTypeOrOp {
19451952

19461953
def_tag!(period_tag, "@period");
19471954
#[derive(Deserialize, Debug, Clone)]
1955+
#[allow(unused)]
19481956
pub struct Period(pub period_tag, pub String, pub LineCol);
19491957

19501958
def_tag!(equals_tag, "==");
@@ -2103,7 +2111,7 @@ def_tag!(defs_tag, "defs");
21032111
pub struct Defs(
21042112
pub defs_tag,
21052113
pub Singleton,
2106-
pub DotOrColon,
2114+
#[allow(unused)] pub DotOrColon,
21072115
pub IdentOrOpOrKeywordOrConst,
21082116
pub ParenOrParams,
21092117
pub Box<DefBodyStmt>,
@@ -2112,7 +2120,9 @@ pub struct Defs(
21122120

21132121
#[derive(RipperDeserialize, Debug, Clone)]
21142122
pub enum IdentOrKw {
2123+
#[allow(unused)]
21152124
Ident(Ident),
2125+
#[allow(unused)]
21162126
Kw(Kw),
21172127
}
21182128

@@ -2126,7 +2136,9 @@ pub enum Singleton {
21262136
// can only occur in defs, Op is always `::`
21272137
#[derive(RipperDeserialize, Debug, Clone)]
21282138
pub enum DotOrColon {
2139+
#[allow(unused)]
21292140
Period(Period),
2141+
#[allow(unused)]
21302142
Op(Operator),
21312143
}
21322144

@@ -2292,7 +2304,9 @@ impl Block {
22922304
// variables are present
22932305
#[derive(RipperDeserialize, Debug, Clone)]
22942306
pub enum BlockLocalVariables {
2307+
#[allow(unused)]
22952308
EmptyBecauseParamsWerePresent(bool),
2309+
#[allow(unused)]
22962310
NilBecauseParamsWereNotPresent(Option<()>),
22972311
Present(Vec<Ident>),
22982312
}

0 commit comments

Comments
 (0)