mirror of
https://github.com/clap-rs/clap
synced 2024-09-20 22:41:52 +00:00
Merge #1679
1679: Remove extern & macro_use where possible r=CreepySkeleton a=pksunkara Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
This commit is contained in:
commit
6f4246ef01
31 changed files with 8 additions and 78 deletions
|
@ -1,10 +1,6 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate clap;
|
||||
extern crate test;
|
||||
|
||||
use clap::App;
|
||||
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate clap;
|
||||
extern crate test;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
use test::Bencher;
|
||||
|
||||
macro_rules! create_app {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate test;
|
||||
|
||||
use clap::{clap_app, App, AppSettings, Arg, ArgSettings};
|
||||
use test::Bencher;
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate clap;
|
||||
extern crate test;
|
||||
|
||||
use test::Bencher;
|
||||
|
||||
use std::io::Cursor;
|
||||
|
||||
use clap::App;
|
||||
use clap::{Arg, ArgSettings};
|
||||
use std::io::Cursor;
|
||||
use test::Bencher;
|
||||
|
||||
fn build_help(app: &mut App) -> String {
|
||||
let mut buf = Cursor::new(Vec::with_capacity(50));
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
|
||||
#![feature(test)]
|
||||
|
||||
extern crate clap;
|
||||
extern crate test;
|
||||
|
||||
use clap::{App, AppSettings, Arg, ArgSettings};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::io::Cursor;
|
||||
use test::Bencher;
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
#![feature(test)]
|
||||
|
||||
extern crate clap;
|
||||
extern crate test;
|
||||
|
||||
use clap::{App, AppSettings, Arg, ArgGroup, ArgSettings};
|
||||
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
|
|
|
@ -10,7 +10,7 @@ consumers.
|
|||
|
||||
## Documentation
|
||||
|
||||
Find it on [Docs.rs](https://docs.rs/clap_derive). You can also check the [examples](https://github.com/clap-rs/clap_derive/tree/master/examples) and the [changelog](https://github.com/clap-rs/clap_derive/blob/master/CHANGELOG.md).
|
||||
Find it on [Docs.rs](https://docs.rs/clap_derive). You can also check the [examples](https://github.com/clap-rs/clap/tree/master/clap_derive/examples) and the [changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md).
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -23,9 +23,6 @@ clap = "3"
|
|||
|
||||
And then, in your rust file:
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use clap::Clap;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// MIT/Apache 2.0 license.
|
||||
use proc_macro2::Span;
|
||||
use proc_macro_error::{abort, abort_call_site, set_dummy};
|
||||
use quote::{quote, quote_spanned};
|
||||
use syn::{self, punctuated, spanned::Spanned, token, FieldsUnnamed, Ident};
|
||||
|
||||
use super::{from_argmatches, into_app, sub_type, Attrs, Kind, Name, ParserKind, Ty};
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
use std::env;
|
||||
|
||||
use proc_macro2;
|
||||
use syn;
|
||||
use syn::punctuated;
|
||||
use quote::{quote, quote_spanned};
|
||||
use syn::spanned::Spanned as _;
|
||||
use syn::token;
|
||||
use syn::{punctuated, token};
|
||||
|
||||
use super::{
|
||||
spanned::Sp, sub_type, Attrs, Kind, Name, ParserKind, Ty, DEFAULT_CASING, DEFAULT_ENV_CASING,
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
use std::env;
|
||||
|
||||
use proc_macro2;
|
||||
use quote::quote;
|
||||
use syn;
|
||||
|
||||
use super::{spanned::Sp, Attrs, GenOutput, Name, DEFAULT_CASING, DEFAULT_ENV_CASING};
|
||||
|
|
|
@ -18,14 +18,9 @@
|
|||
#![recursion_limit = "256"]
|
||||
|
||||
extern crate proc_macro;
|
||||
extern crate syn;
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
extern crate heck;
|
||||
extern crate proc_macro2;
|
||||
extern crate proc_macro_error;
|
||||
|
||||
use proc_macro_error::proc_macro_error;
|
||||
use syn;
|
||||
|
||||
mod derives;
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate clap;
|
||||
|
||||
use clap::Clap;
|
||||
|
||||
fn try_str(s: &str) -> Result<String, std::convert::Infallible> {
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#![allow(unused)]
|
||||
extern crate clap;
|
||||
|
||||
use clap::IntoApp;
|
||||
|
||||
pub fn get_help<T: IntoApp>() -> String {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::App;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::App;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
/// of the three numbers. So you create three flags `--major`, `--minor`, and `--patch`. All of
|
||||
/// these arguments shouldn't be used at one time but you want to specify that *at least one* of
|
||||
/// them is used. For this, you can create a group.
|
||||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg, ArgGroup};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, AppSettings};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
// Let's make a quick program to illustrate. We'll be using the same example as above but for
|
||||
// brevity sake we won't implement all of the subcommands, only a few.
|
||||
|
||||
extern crate clap;
|
||||
|
||||
use clap::{App, AppSettings, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
/// myprog -f -p=bob -- sloppy slop slop
|
||||
|
|
|
@ -186,7 +186,6 @@
|
|||
//! //
|
||||
//! // This example demonstrates clap's building from YAML style of creating arguments which is far
|
||||
//! // more clean, but takes a very small performance hit compared to the other two methods.
|
||||
//! #[macro_use]
|
||||
//! use clap::App;
|
||||
//!
|
||||
//! fn main() {
|
||||
|
|
Loading…
Reference in a new issue