mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
This eliminates the need for `expect_punct` helper. Reviewed-by: Tamir Duberstein <tamird@gmail.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260112170919.1888584-8-gary@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
36 lines
681 B
Rust
36 lines
681 B
Rust
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
use proc_macro2::{
|
|
Ident,
|
|
TokenStream,
|
|
TokenTree, //
|
|
};
|
|
use syn::{
|
|
parse::{
|
|
Parse,
|
|
ParseStream, //
|
|
},
|
|
Result,
|
|
Token, //
|
|
};
|
|
|
|
pub(crate) struct Input {
|
|
a: Ident,
|
|
_comma: Token![,],
|
|
b: Ident,
|
|
}
|
|
|
|
impl Parse for Input {
|
|
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
|
Ok(Self {
|
|
a: input.parse()?,
|
|
_comma: input.parse()?,
|
|
b: input.parse()?,
|
|
})
|
|
}
|
|
}
|
|
|
|
pub(crate) fn concat_idents(Input { a, b, .. }: Input) -> TokenStream {
|
|
let res = Ident::new(&format!("{a}{b}"), b.span());
|
|
TokenStream::from_iter([TokenTree::Ident(res)])
|
|
}
|