Skip to content

Commit a8dae43

Browse files
committed
rust: macros: remove helpers
Only one helper function (`expect_punct`) is used by our proc-macros. So remove all others and move `expect_punct` into concat_idents.rs. Signed-off-by: Benno Lossin <[email protected]>
1 parent 5d4eb2d commit a8dae43

File tree

3 files changed

+7
-221
lines changed

3 files changed

+7
-221
lines changed

rust/macros/concat_idents.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
use proc_macro2::{token_stream, Ident, TokenStream, TokenTree};
44

5-
use crate::helpers::expect_punct;
6-
75
fn expect_ident(it: &mut token_stream::IntoIter) -> Ident {
86
if let Some(TokenTree::Ident(ident)) = it.next() {
97
ident
108
} else {
119
panic!("Expected Ident")
1210
}
1311
}
12+
fn expect_punct(it: &mut token_stream::IntoIter) -> char {
13+
if let TokenTree::Punct(punct) = it.next().expect("Reached end of token stream for Punct") {
14+
punct.as_char()
15+
} else {
16+
panic!("Expected Punct");
17+
}
18+
}
1419

1520
pub(crate) fn concat_idents(ts: TokenStream) -> TokenStream {
1621
let mut it = ts.into_iter();

rust/macros/helpers.rs

-218
This file was deleted.

rust/macros/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! Crate for all kernel procedural macros.
44
55
mod concat_idents;
6-
mod helpers;
76
mod module;
87
mod paste;
98
mod pin_data;

0 commit comments

Comments
 (0)