Skip to content

Commit 861ed2c

Browse files
paldepindCopilot
andcommitted
Rust: Adapt rust-analyzer codegen patch
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ac3746f commit 861ed2c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎rust/ast-generator/patches/rust-analyzer.patch‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
diff --git a/xtask/src/codegen/grammar.rs b/xtask/src/codegen/grammar.rs
2-
index 257429c..ddbe321 100644
2+
index 0aad1e2..68f679f 100644
33
--- a/xtask/src/codegen/grammar.rs
44
+++ b/xtask/src/codegen/grammar.rs
5-
@@ -3,7 +3,9 @@
5+
@@ -3,6 +3,10 @@
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)]
109
+#![allow(warnings)]
1110
+#![allow(clippy)]
1211
+#![cfg_attr(any(), rustfmt::skip)]
13-
12+
+
1413
use std::{
1514
collections::{BTreeSet, HashSet},
16-
@@ -23,7 +25,7 @@ use crate::{
15+
fmt::Write,
16+
@@ -21,7 +25,7 @@ use crate::{
1717
project_root,
1818
};
1919

@@ -22,7 +22,7 @@ index 257429c..ddbe321 100644
2222
use self::ast_src::{AstEnumSrc, AstNodeSrc, AstSrc, Cardinality, Field, KindsSrc};
2323

2424
pub(crate) fn generate(check: bool) {
25-
@@ -775,7 +777,7 @@ fn pluralize(s: &str) -> String {
25+
@@ -775,7 +779,7 @@ fn pluralize(s: &str) -> String {
2626
}
2727

2828
impl Field {
@@ -31,7 +31,7 @@ index 257429c..ddbe321 100644
3131
matches!(self, Field::Node { cardinality: Cardinality::Many, .. })
3232
}
3333
fn token_kind(&self) -> Option<proc_macro2::TokenStream> {
34-
@@ -787,7 +789,7 @@ impl Field {
34+
@@ -787,7 +791,7 @@ impl Field {
3535
_ => None,
3636
}
3737
}
@@ -40,7 +40,7 @@ index 257429c..ddbe321 100644
4040
match self {
4141
Field::Token { name, token, .. } => {
4242
if let Some(name) = name {
43-
@@ -836,7 +838,7 @@ impl Field {
43+
@@ -836,7 +840,7 @@ impl Field {
4444
}
4545
}
4646
}
@@ -49,7 +49,7 @@ index 257429c..ddbe321 100644
4949
match self {
5050
Field::Token { .. } => format_ident!("SyntaxToken"),
5151
Field::Node { ty, .. } => format_ident!("{}", ty),
52-
@@ -849,7 +851,7 @@ fn clean_token_name(name: &str) -> String {
52+
@@ -849,7 +853,7 @@ fn clean_token_name(name: &str) -> String {
5353
if cleaned.is_empty() { name.to_owned() } else { cleaned.to_owned() }
5454
}
5555

@@ -59,7 +59,7 @@ index 257429c..ddbe321 100644
5959
tokens:
6060
"Whitespace Comment String ByteString CString IntNumber FloatNumber Char Byte Ident"
6161
diff --git a/xtask/src/codegen/grammar/ast_src.rs b/xtask/src/codegen/grammar/ast_src.rs
62-
index a0abdf0..5f59f97 100644
62+
index 1ae139f..d4d791e 100644
6363
--- a/xtask/src/codegen/grammar/ast_src.rs
6464
+++ b/xtask/src/codegen/grammar/ast_src.rs
6565
@@ -1,5 +1,8 @@

0 commit comments

Comments
 (0)