Skip to content

Commit d300ffc

Browse files
committed
Fix clippy lints
1 parent 48290c6 commit d300ffc

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

cfgrammar/src/lib/yacc/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ mod test {
825825
"#;
826826

827827
let astart_ast_validity =
828-
ASTWithValidityInfo::new(YaccKind::Original(YaccOriginalActionKind::NoAction), &y_src);
828+
ASTWithValidityInfo::new(YaccKind::Original(YaccOriginalActionKind::NoAction), y_src);
829829
let bstart_rule = astart_ast_validity.ast().get_rule("BStart").unwrap();
830830
let bstart_ast_validity = astart_ast_validity
831831
.clone_and_change_start_rule(bstart_rule.clone())

lrlex/src/lib/ctbuilder.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ where
321321
/// .lexer_in_src_dir("calc.l")?
322322
/// .build()?;
323323
/// ```
324-
pub fn lrpar_config<F: 'a>(mut self, config_func: F) -> Self
324+
pub fn lrpar_config<F>(mut self, config_func: F) -> Self
325325
where
326-
F: Fn(CTParserBuilder<LexerTypesT>) -> CTParserBuilder<LexerTypesT>,
326+
F: Fn(CTParserBuilder<LexerTypesT>) -> CTParserBuilder<LexerTypesT> + 'a,
327327
{
328328
self.lrpar_config = Some(Box::new(config_func));
329329
self
@@ -1375,11 +1375,10 @@ impl<StorageT: Display + ToTokens> CTTokenMapBuilder<StorageT> {
13751375
))
13761376
})
13771377
.collect::<Result<(TokenStream, TokenStream), Box<dyn Error>>>()?;
1378-
let unused_annotation;
1379-
if self.allow_dead_code {
1380-
unused_annotation = quote! {#[allow(dead_code)]};
1378+
let unused_annotation = if self.allow_dead_code {
1379+
quote! {#[allow(dead_code)]}
13811380
} else {
1382-
unused_annotation = quote! {};
1381+
quote! {}
13831382
};
13841383
// Since the formatter doesn't preserve comments and we don't want to lose build time,
13851384
// just format the module contents.

lrpar/cttests/src/grmtools_section.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ grammar: |
119119
array_seq -> Vec<Setting<Span>>
120120
: %empty { Vec::new() }
121121
| val {
122-
let mut x = Vec::new();
123-
x.push($1);
124-
x
122+
vec![$1]
125123
}
126124
| array_seq ',' val {
127125
$1.push($3);

lrpar/cttests/src/multi_start.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
%%
55

66
AStart -> ()
7-
: A ':' BStart ';' {()}
7+
: A ':' BStart ';' {}
88
;
99

1010
BStart -> ()
11-
: B ',' C {()}
12-
| C ',' B {()}
13-
;
11+
: B ',' C {}
12+
| C ',' B {}
13+
;

lrpar/examples/calc_ast_arena/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ fn eval(
6161
e: &Expr,
6262
) -> Result<u64, (Span, &'static str)> {
6363
match e {
64-
Expr::Add { span, lhs, rhs } => eval(lexer, *lhs)?
65-
.checked_add(eval(lexer, *rhs)?)
64+
Expr::Add { span, lhs, rhs } => eval(lexer, lhs)?
65+
.checked_add(eval(lexer, rhs)?)
6666
.ok_or((*span, "overflowed")),
67-
Expr::Mul { span, lhs, rhs } => eval(lexer, *lhs)?
68-
.checked_mul(eval(lexer, *rhs)?)
67+
Expr::Mul { span, lhs, rhs } => eval(lexer, lhs)?
68+
.checked_mul(eval(lexer, rhs)?)
6969
.ok_or((*span, "overflowed")),
7070
Expr::Number { span } => lexer
7171
.span_str(*span)

0 commit comments

Comments
 (0)