mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
fix: Remove untested IntoApp derive
This commit is contained in:
parent
aeb295897d
commit
64d052f8b8
3 changed files with 1 additions and 31 deletions
|
@ -15,35 +15,14 @@
|
|||
use std::env;
|
||||
|
||||
use proc_macro2::{Span, TokenStream};
|
||||
use proc_macro_error::abort_call_site;
|
||||
use quote::quote;
|
||||
use syn::{Attribute, Data, DataStruct, DeriveInput, Fields, Generics, Ident};
|
||||
use syn::{Attribute, Generics, Ident};
|
||||
|
||||
use crate::{
|
||||
attrs::{Attrs, Name, DEFAULT_CASING, DEFAULT_ENV_CASING},
|
||||
dummies,
|
||||
utils::Sp,
|
||||
};
|
||||
|
||||
pub fn derive_into_app(input: &DeriveInput) -> TokenStream {
|
||||
let ident = &input.ident;
|
||||
|
||||
dummies::into_app(ident);
|
||||
|
||||
match input.data {
|
||||
Data::Struct(DataStruct {
|
||||
fields: Fields::Named(_),
|
||||
..
|
||||
}) => gen_for_struct(ident, &input.generics, &input.attrs),
|
||||
Data::Struct(DataStruct {
|
||||
fields: Fields::Unit,
|
||||
..
|
||||
}) => gen_for_struct(ident, &input.generics, &input.attrs),
|
||||
Data::Enum(_) => gen_for_enum(ident, &input.generics, &input.attrs),
|
||||
_ => abort_call_site!("`#[derive(IntoApp)]` only supports non-tuple structs and enums"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gen_for_struct(
|
||||
struct_name: &Ident,
|
||||
generics: &Generics,
|
||||
|
|
|
@ -20,5 +20,4 @@ mod subcommand;
|
|||
pub use self::parser::derive_parser;
|
||||
pub use arg_enum::derive_arg_enum;
|
||||
pub use args::derive_args;
|
||||
pub use into_app::derive_into_app;
|
||||
pub use subcommand::derive_subcommand;
|
||||
|
|
|
@ -50,14 +50,6 @@ pub fn parser(input: TokenStream) -> TokenStream {
|
|||
derives::derive_parser(&input).into()
|
||||
}
|
||||
|
||||
/// Generates the `IntoApp` impl.
|
||||
#[proc_macro_derive(IntoApp, attributes(clap))]
|
||||
#[proc_macro_error]
|
||||
pub fn into_app(input: TokenStream) -> TokenStream {
|
||||
let input: DeriveInput = parse_macro_input!(input);
|
||||
derives::derive_into_app(&input).into()
|
||||
}
|
||||
|
||||
/// Generates the `Subcommand` impl.
|
||||
#[proc_macro_derive(Subcommand, attributes(clap))]
|
||||
#[proc_macro_error]
|
||||
|
|
Loading…
Add table
Reference in a new issue