mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-04 18:40:18 +00:00
14 lines
444 B
Rust
14 lines
444 B
Rust
|
extern crate proc_macro;
|
||
|
|
||
|
use proc_macro::{Delimiter, Group, Ident, TokenStream, TokenTree};
|
||
|
|
||
|
#[proc_macro]
|
||
|
pub fn unsafe_block(input: TokenStream) -> TokenStream {
|
||
|
let span = input.into_iter().next().unwrap().span();
|
||
|
TokenStream::from_iter([TokenTree::Ident(Ident::new("unsafe", span)), {
|
||
|
let mut group = Group::new(Delimiter::Brace, TokenStream::new());
|
||
|
group.set_span(span);
|
||
|
TokenTree::Group(group)
|
||
|
}])
|
||
|
}
|