#![warn(
missing_docs,
rustdoc::all,
clippy::missing_docs_in_private_items,
clippy::all,
clippy::restriction,
clippy::pedantic,
clippy::nursery,
clippy::cargo
)]
#![allow(
clippy::blanket_clippy_restriction_lints,
clippy::implicit_return,
clippy::integer_arithmetic,
clippy::mod_module_files,
clippy::pattern_type_mismatch,
clippy::pub_use,
clippy::question_mark_used,
clippy::string_add,
clippy::wildcard_enum_match_arm,
clippy::wildcard_imports
)]
#![deny(warnings)]
macro_rules! bs_delim_span {
($d:ident) => {
proc_macro2::Group::new(proc_macro2::Delimiter::$d, proc_macro2::TokenStream::new())
.delim_span()
};
}
macro_rules! token {
($t:ident) => {
syn::token::$t {
spans: [proc_macro2::Span::call_site()],
}
};
}
macro_rules! single_token {
($t:ident) => {
syn::token::$t {
span: proc_macro2::Span::call_site(),
}
};
}
macro_rules! dual_token {
($t:ident) => {
syn::token::$t {
spans: [
proc_macro2::Span::call_site(),
proc_macro2::Span::call_site(),
],
}
};
}
macro_rules! delim_token {
(Paren) => {
syn::token::Paren {
span: bs_delim_span!(Parenthesis),
}
};
($d:ident) => {
syn::token::$d {
span: bs_delim_span!($d),
}
};
}
mod mutate;
mod x;
const CRATE_NAME: &str = "sleuth";
#[proc_macro_attribute]
pub fn sleuth(
attr: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
match mutate::implementation(attr.into(), input.into()) {
Ok(ts) => ts,
Err(e) => e.to_compile_error(),
}
.into()
}
#[inline]
fn make_punc<T, P>(v: T) -> syn::punctuated::Punctuated<T, P> {
let mut punc = syn::punctuated::Punctuated::new();
punc.push_value(v);
punc
}
#[inline]
fn ident(s: &str) -> syn::Ident {
syn::Ident::new(s, proc_macro2::Span::call_site())
}
#[inline]
const fn pathseg(fn_name: syn::Ident) -> syn::PathSegment {
syn::PathSegment {
ident: fn_name,
arguments: syn::PathArguments::None,
}
}