Skip to content

Commit df39610

Browse files
author
Paolo Tranquilli
committed
Rust: skip injected sources in clippy and fmt checks
1 parent 110d399 commit df39610

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
diff --git a/xtask/src/codegen/grammar.rs b/xtask/src/codegen/grammar.rs
2-
index e7534582f2..8bc9237737 100644
2+
index e7534582f2..49c96f1be3 100644
33
--- a/xtask/src/codegen/grammar.rs
44
+++ b/xtask/src/codegen/grammar.rs
5-
@@ -3,6 +3,7 @@
5+
@@ -3,7 +3,9 @@
66
//! Specifically, it generates the `SyntaxKind` enum and a number of newtype
77
//! wrappers around `SyntaxNode` which implement `syntax::AstNode`.
88

9+
-#![allow(clippy::disallowed_types)]
910
+#![allow(warnings)]
10-
#![allow(clippy::disallowed_types)]
11+
+#![allow(clippy)]
12+
+#![cfg_attr(any(), rustfmt::skip)]
1113

1214
use std::{
13-
@@ -23,7 +24,7 @@ use crate::{
15+
collections::{BTreeSet, HashSet},
16+
@@ -23,7 +25,7 @@ use crate::{
1417
project_root,
1518
};
1619

@@ -19,7 +22,7 @@ index e7534582f2..8bc9237737 100644
1922
use self::ast_src::{AstEnumSrc, AstNodeSrc, AstSrc, Cardinality, Field, KindsSrc};
2023

2124
pub(crate) fn generate(check: bool) {
22-
@@ -624,7 +625,7 @@ fn pluralize(s: &str) -> String {
25+
@@ -624,7 +626,7 @@ fn pluralize(s: &str) -> String {
2326
}
2427

2528
impl Field {
@@ -28,7 +31,7 @@ index e7534582f2..8bc9237737 100644
2831
matches!(self, Field::Node { cardinality: Cardinality::Many, .. })
2932
}
3033
fn token_kind(&self) -> Option<proc_macro2::TokenStream> {
31-
@@ -636,7 +637,7 @@ impl Field {
34+
@@ -636,7 +638,7 @@ impl Field {
3235
_ => None,
3336
}
3437
}
@@ -37,7 +40,7 @@ index e7534582f2..8bc9237737 100644
3740
match self {
3841
Field::Token(name) => {
3942
let name = match name.as_str() {
40-
@@ -682,7 +683,7 @@ impl Field {
43+
@@ -682,7 +684,7 @@ impl Field {
4144
}
4245
}
4346
}
@@ -46,7 +49,7 @@ index e7534582f2..8bc9237737 100644
4649
match self {
4750
Field::Token(_) => format_ident!("SyntaxToken"),
4851
Field::Node { ty, .. } => format_ident!("{}", ty),
49-
@@ -699,7 +700,7 @@ fn clean_token_name(name: &str) -> String {
52+
@@ -699,7 +701,7 @@ fn clean_token_name(name: &str) -> String {
5053
}
5154
}
5255

@@ -55,3 +58,16 @@ index e7534582f2..8bc9237737 100644
5558
let mut res = AstSrc {
5659
tokens:
5760
"Whitespace Comment String ByteString CString IntNumber FloatNumber Char Byte Ident"
61+
diff --git a/xtask/src/codegen/grammar/ast_src.rs b/xtask/src/codegen/grammar/ast_src.rs
62+
index 9269d15423..babe7ca1bf 100644
63+
--- a/xtask/src/codegen/grammar/ast_src.rs
64+
+++ b/xtask/src/codegen/grammar/ast_src.rs
65+
@@ -1,5 +1,8 @@
66+
//! Defines input for code generation process.
67+
68+
+#![allow(clippy)]
69+
+#![cfg_attr(any(), rustfmt::skip)]
70+
+
71+
use quote::ToTokens;
72+
73+
use crate::codegen::grammar::to_upper_snake_case;

0 commit comments

Comments
 (0)