Skip to content

Commit 3b39d67

Browse files
committed
swap some lints from allow to expect
1 parent e7e231b commit 3b39d67

9 files changed

Lines changed: 36 additions & 42 deletions

File tree

src/error/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub type CResult<T> = Result<T, CError>;
88
/// Collection of errors which may occur during compilation.
99
#[derive(Clone, Debug, thiserror::Error)]
1010
#[error(transparent)]
11-
#[allow(
11+
#[expect(
1212
clippy::enum_variant_names,
1313
reason = "postfix `Gen` refers to the name of the pass from which the errors originate"
1414
)]

src/ir/cst.rs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ mod function {
4343
/// ```
4444
#[derive(Clone, Debug)]
4545
pub struct FunctionDeclaration {
46-
#[allow(dead_code, reason = "token field")]
46+
#[expect(dead_code, reason = "token field")]
4747
pub tok_fn: tok::Fn,
4848
/// Name of the function.
4949
pub name: tok::Ident,
50-
#[allow(dead_code, reason = "token field")]
50+
#[expect(dead_code, reason = "token field")]
5151
pub tok_l_parenthesis: tok::LParenthesis,
5252
/// Parameters for the function.
5353
pub parameters: PunctuatedList<FunctionParameter, tok::Comma>,
54-
#[allow(dead_code, reason = "token field")]
54+
#[expect(dead_code, reason = "token field")]
5555
pub tok_r_parenthesis: tok::RParenthesis,
5656
/// Optional return type for the function.
5757
pub return_ty: Option<FunctionReturnType>,
@@ -67,7 +67,7 @@ mod function {
6767
pub struct FunctionParameter {
6868
/// Name of the parameter.
6969
pub name: tok::Ident,
70-
#[allow(dead_code, reason = "token field")]
70+
#[expect(dead_code, reason = "token field")]
7171
pub tok_colon: tok::Colon,
7272
/// Type of the parameter.
7373
pub ty: tok::Ident,
@@ -80,7 +80,7 @@ mod function {
8080
/// ```
8181
#[derive(Clone, Debug)]
8282
pub struct FunctionReturnType {
83-
#[allow(dead_code, reason = "token field")]
83+
#[expect(dead_code, reason = "token field")]
8484
pub tok_thin_arrow: tok::ThinArrow,
8585
/// Return type.
8686
pub ty: tok::Ident,
@@ -90,11 +90,11 @@ mod function {
9090
/// Block, containing a collection of [`Statement`]s.
9191
#[derive(Clone, Debug)]
9292
pub struct Block {
93-
#[allow(dead_code, reason = "token field")]
93+
#[expect(dead_code, reason = "token field")]
9494
pub tok_l_brace: tok::LBrace,
9595
/// Collection of statements.
9696
pub statements: Vec<Statement>,
97-
#[allow(dead_code, reason = "token field")]
97+
#[expect(dead_code, reason = "token field")]
9898
pub tok_r_brace: tok::RBrace,
9999
}
100100

@@ -115,35 +115,35 @@ mod statement {
115115
/// A `let` statement creates a new binding (`name`), and assigns `value` to it.
116116
#[derive(Clone, Debug)]
117117
pub struct LetStatement {
118-
#[allow(dead_code, reason = "token field")]
118+
#[expect(dead_code, reason = "token field")]
119119
pub tok_let: tok::Let,
120120
/// Name of the variable.
121121
pub variable: tok::Ident,
122-
#[allow(dead_code, reason = "token field")]
122+
#[expect(dead_code, reason = "token field")]
123123
pub tok_eq: tok::Eq,
124124
/// Value that was assigned.
125125
pub value: Expression,
126-
#[allow(dead_code, reason = "token field")]
126+
#[expect(dead_code, reason = "token field")]
127127
pub tok_semicolon: tok::SemiColon,
128128
}
129129

130130
/// A `return` statement returns `value`.
131131
#[derive(Clone, Debug)]
132132
pub struct ReturnStatement {
133-
#[allow(dead_code, reason = "token field")]
133+
#[expect(dead_code, reason = "token field")]
134134
pub tok_return: tok::Return,
135135
/// Value that is being returned.
136136
pub value: Expression,
137-
#[allow(dead_code, reason = "token field")]
137+
#[expect(dead_code, reason = "token field")]
138138
pub tok_semicolon: tok::SemiColon,
139139
}
140140

141141
#[derive(Clone, Debug)]
142142
pub struct BreakStatement {
143-
#[allow(dead_code, reason = "token field")]
143+
#[expect(dead_code, reason = "token field")]
144144
pub tok_break: tok::Break,
145145
pub value: Option<Expression>,
146-
#[allow(dead_code, reason = "token field")]
146+
#[expect(dead_code, reason = "token field")]
147147
pub tok_semicolon: tok::SemiColon,
148148
}
149149

@@ -153,7 +153,6 @@ mod statement {
153153
/// Expression.
154154
pub expression: Expression,
155155
/// Can be optionally terminated by semicolon.
156-
#[allow(dead_code, reason = "token field")]
157156
pub tok_semicolon: Option<tok::SemiColon>,
158157
}
159158

@@ -196,7 +195,7 @@ mod expression {
196195
pub struct Assign {
197196
/// Variable being assigned to.
198197
pub assignee: Box<Expression>,
199-
#[allow(dead_code, reason = "token field")]
198+
#[expect(dead_code, reason = "token field")]
200199
pub tok_eq: tok::Eq,
201200
/// Value of the assignment.
202201
pub value: Box<Expression>,
@@ -256,7 +255,7 @@ mod expression {
256255
/// An `if` statement
257256
#[derive(Clone, Debug)]
258257
pub struct If {
259-
#[allow(dead_code, reason = "token field")]
258+
#[expect(dead_code, reason = "token field")]
260259
pub tok_if: tok::If,
261260
/// Condition that is being checked.
262261
pub condition: Box<Expression>,
@@ -269,7 +268,7 @@ mod expression {
269268
/// Optional trailing section of an `if` statement.
270269
#[derive(Clone, Debug)]
271270
pub struct IfTrailer {
272-
#[allow(dead_code, reason = "token field")]
271+
#[expect(dead_code, reason = "token field")]
273272
pub tok_else: tok::Else,
274273
/// Can be followed by `if` with another condition, or a final block.
275274
pub if_or_block: IfOrBlock,
@@ -295,16 +294,15 @@ mod expression {
295294

296295
#[derive(Clone, Debug)]
297296
pub struct Loop {
298-
#[allow(dead_code, reason = "token field")]
297+
#[expect(dead_code, reason = "token field")]
299298
pub tok_loop: tok::Loop,
300299
pub body: Block,
301300
}
302301

303302
// TODO: Implement while loops
304303
#[derive(Clone, Debug)]
305-
#[allow(dead_code, reason = "while statements will be implemented after loops")]
304+
#[expect(dead_code, reason = "while statements will be implemented after loops")]
306305
pub struct While {
307-
#[allow(dead_code, reason = "token field")]
308306
pub tok_while: tok::While,
309307
pub condition: Box<Expression>,
310308
pub body: Block,
@@ -349,9 +347,9 @@ mod expression {
349347

350348
#[derive(Clone, Debug)]
351349
pub struct UnitLiteral {
352-
#[allow(dead_code, reason = "token field")]
350+
#[expect(dead_code, reason = "token field")]
353351
pub tok_l_parenthesis: tok::LParenthesis,
354-
#[allow(dead_code, reason = "token field")]
352+
#[expect(dead_code, reason = "token field")]
355353
pub tok_r_parenthesis: tok::RParenthesis,
356354
}
357355

@@ -365,11 +363,11 @@ mod expression {
365363
/// An [`Expression`] wrapped in parentheses.
366364
#[derive(Clone, Debug)]
367365
pub struct Parenthesis {
368-
#[allow(dead_code, reason = "token field")]
366+
#[expect(dead_code, reason = "token field")]
369367
pub tok_l_parenthesis: tok::LParenthesis,
370368
/// Inner expression.
371369
pub expression: Box<Expression>,
372-
#[allow(dead_code, reason = "token field")]
370+
#[expect(dead_code, reason = "token field")]
373371
pub tok_r_parenthesis: tok::RParenthesis,
374372
}
375373

@@ -378,11 +376,11 @@ mod expression {
378376
pub struct Call {
379377
/// Callee of the function.
380378
pub callee: Box<Expression>,
381-
#[allow(dead_code, reason = "token field")]
379+
#[expect(dead_code, reason = "token field")]
382380
pub tok_l_parenthesis: tok::LParenthesis,
383381
/// Arguments passed to the call.
384382
pub arguments: PunctuatedList<Expression, tok::Comma>,
385-
#[allow(dead_code, reason = "token field")]
383+
#[expect(dead_code, reason = "token field")]
386384
pub tok_r_parenthesis: tok::RParenthesis,
387385
}
388386

src/ir/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mod statement {
8888

8989
#[derive(Clone, Debug)]
9090
pub enum DeclarationTy {
91-
#[allow(
91+
#[expect(
9292
dead_code,
9393
reason = "will be used when variable declarations can be explicitly typed."
9494
)]

src/ir/mir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ mod statement {
214214

215215
#[derive(Clone, Debug)]
216216
pub struct StorageLive {
217-
#[allow(
217+
#[expect(
218218
dead_code,
219219
reason = "storage statements are not currently implemented."
220220
)]
@@ -223,7 +223,7 @@ mod statement {
223223

224224
#[derive(Clone, Debug)]
225225
pub struct StorageDead {
226-
#[allow(
226+
#[expect(
227227
dead_code,
228228
reason = "storage statements are not currently implemented."
229229
)]
@@ -301,7 +301,7 @@ mod rvalue {
301301
#[derive(Clone, Debug)]
302302
pub enum RValue {
303303
Use(OperandId),
304-
#[allow(
304+
#[expect(
305305
dead_code,
306306
reason = "will soon remove ref from `UnaryOperation` for MIR"
307307
)]

src/passes/cst_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ mod expression {
166166
Sum,
167167
Multiply,
168168
Prefix,
169-
#[allow(dead_code, reason = "cast expressions are not currently implemented.")]
169+
#[expect(dead_code, reason = "cast expressions are not currently implemented.")]
170170
Cast,
171171
Call,
172172
}

src/passes/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ pub enum PassSuccess<T> {
3737
/// Outcome of this pass.
3838
outcome: T,
3939
/// Produced (non-fatal) errors.
40-
#[allow(
41-
dead_code,
42-
reason = "will be useful when better error handling is implemented."
43-
)]
4440
errors: Vec<CErrorId>,
4541
},
4642
}
@@ -57,7 +53,7 @@ impl<T> PassSuccess<T> {
5753
}
5854

5955
/// Produce a reference to the outcome.
60-
#[allow(
56+
#[expect(
6157
dead_code,
6258
reason = "will be useful when better error handling is implemented."
6359
)]
@@ -69,7 +65,7 @@ impl<T> PassSuccess<T> {
6965
}
7066

7167
/// Produce a slice to the errors.
72-
#[allow(
68+
#[expect(
7369
dead_code,
7470
reason = "will be useful when better error handling is implemented."
7571
)]

src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Literal {
7878
pub enum IntegerKind {
7979
Any,
8080
Signed,
81-
#[allow(
81+
#[expect(
8282
dead_code,
8383
reason = "future constraints may require an unsigned integer."
8484
)]

src/util/indexed_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl<K, V> IndexedVec<K, V> {
99
}
1010

1111
#[doc(hidden)]
12-
#[allow(dead_code, reason = "used within `indexed_vec` macro")]
12+
#[expect(dead_code, reason = "used within `indexed_vec` macro")]
1313
pub fn from_vec(vec: Vec<V>) -> Self {
1414
Self(vec, PhantomData)
1515
}

src/util/scopes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Scope {
2424
#[derive(Clone, Debug)]
2525
struct BindingMeta {
2626
/// Scope in which this binding exists.
27-
#[allow(dead_code, reason = "will be useful information in the future")]
27+
#[expect(dead_code, reason = "will be useful information in the future")]
2828
scope: ScopeId,
2929
/// String this binding was created from.
3030
string: StringId,

0 commit comments

Comments
 (0)