Remove `macro_use` on `extern crate` (#47)
* Remove macro_use from examples * Remove macro_use from log and rocket * Remove macro_use for serde_derive * Remove from examples * Fix no-default features build failure
This commit is contained in:
parent
086f018bb9
commit
b80c1939d4
|
@ -1,9 +1,9 @@
|
|||
#![feature(proc_macro_hygiene, decl_macro)]
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate rocket_cors;
|
||||
|
||||
use rocket::http::Method;
|
||||
use rocket::{get, routes};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins};
|
||||
|
||||
#[get("/")]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![feature(proc_macro_hygiene, decl_macro)]
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate rocket_cors;
|
||||
|
||||
|
@ -7,6 +6,7 @@ use std::io::Cursor;
|
|||
|
||||
use rocket::http::Method;
|
||||
use rocket::Response;
|
||||
use rocket::{get, options, routes};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Guard, Responder};
|
||||
|
||||
/// Using a `Responder` -- the usual way you would use this
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![feature(proc_macro_hygiene, decl_macro)]
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate rocket_cors;
|
||||
|
||||
|
@ -7,7 +6,7 @@ use std::io::Cursor;
|
|||
|
||||
use rocket::http::Method;
|
||||
use rocket::response::Responder;
|
||||
use rocket::{Response, State};
|
||||
use rocket::{get, options, routes, Response, State};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors};
|
||||
|
||||
/// Using a borrowed Cors
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
//! `ping` route that you want to allow all Origins to access.
|
||||
|
||||
#![feature(proc_macro_hygiene, decl_macro)]
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate rocket_cors;
|
||||
|
||||
use rocket::http::Method;
|
||||
use rocket::response::Responder;
|
||||
use rocket::{get, options, routes};
|
||||
use rocket_cors::{AllowedHeaders, AllowedOrigins, Cors, Guard};
|
||||
|
||||
/// The "usual" app route
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
//! Fairing implementation
|
||||
use std::str::FromStr;
|
||||
|
||||
use log::{error, info, log};
|
||||
use rocket::http::{self, uri::Origin, Header, Status};
|
||||
use rocket::{self, Outcome, Request};
|
||||
use rocket::{self, error_, info_, log_, Outcome, Request};
|
||||
|
||||
use crate::{
|
||||
actual_request_response, origin, preflight_response, request_headers, validate, Cors, Error,
|
||||
|
|
|
@ -8,6 +8,8 @@ use std::str::FromStr;
|
|||
use rocket::http::Status;
|
||||
use rocket::request::{self, FromRequest};
|
||||
use rocket::{self, Outcome};
|
||||
#[cfg(feature = "serialization")]
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use unicase::UniCase;
|
||||
use url;
|
||||
|
||||
|
|
25
src/lib.rs
25
src/lib.rs
|
@ -102,9 +102,10 @@
|
|||
//!
|
||||
//! ```rust,no_run
|
||||
//! #![feature(proc_macro_hygiene, decl_macro)]
|
||||
//! #[macro_use] extern crate rocket;
|
||||
//! extern crate rocket;
|
||||
//! extern crate rocket_cors;
|
||||
//!
|
||||
//! use rocket::{get, routes};
|
||||
//! use rocket::http::Method;
|
||||
//! use rocket_cors::{AllowedOrigins, AllowedHeaders};
|
||||
//!
|
||||
|
@ -176,12 +177,12 @@
|
|||
//!
|
||||
//! ```rust,no_run
|
||||
//! #![feature(proc_macro_hygiene, decl_macro)]
|
||||
//! #[macro_use] extern crate rocket;
|
||||
//! extern crate rocket;
|
||||
//! extern crate rocket_cors;
|
||||
//!
|
||||
//! use std::io::Cursor;
|
||||
//!
|
||||
//! use rocket::Response;
|
||||
//! use rocket::{Response, get, options, routes};
|
||||
//! use rocket::http::Method;
|
||||
//! use rocket_cors::{Guard, AllowedOrigins, AllowedHeaders, Responder};
|
||||
//!
|
||||
|
@ -294,9 +295,10 @@
|
|||
//!
|
||||
//! ```rust,no_run
|
||||
//! #![feature(proc_macro_hygiene, decl_macro)]
|
||||
//! #[macro_use] extern crate rocket;
|
||||
//! extern crate rocket;
|
||||
//! extern crate rocket_cors;
|
||||
//!
|
||||
//! use rocket::{get, options, routes};
|
||||
//! use rocket::http::Method;
|
||||
//! use rocket::response::Responder;
|
||||
//! use rocket_cors::{Cors, AllowedOrigins, AllowedHeaders};
|
||||
|
@ -350,12 +352,12 @@
|
|||
//!
|
||||
//! ```rust,no_run
|
||||
//! #![feature(proc_macro_hygiene, decl_macro)]
|
||||
//! #[macro_use] extern crate rocket;
|
||||
//! extern crate rocket;
|
||||
//! extern crate rocket_cors;
|
||||
//!
|
||||
//! use std::io::Cursor;
|
||||
//!
|
||||
//! use rocket::{State, Response};
|
||||
//! use rocket::{State, Response, get, routes};
|
||||
//! use rocket::http::Method;
|
||||
//! use rocket::response::Responder;
|
||||
//! use rocket_cors::{Cors, AllowedOrigins, AllowedHeaders};
|
||||
|
@ -418,9 +420,10 @@
|
|||
//!
|
||||
//! ```rust,no_run
|
||||
//! #![feature(proc_macro_hygiene, decl_macro)]
|
||||
//! #[macro_use] extern crate rocket;
|
||||
//! extern crate rocket;
|
||||
//! extern crate rocket_cors;
|
||||
//!
|
||||
//! use rocket::{get, options, routes};
|
||||
//! use rocket::http::Method;
|
||||
//! use rocket::response::Responder;
|
||||
//! use rocket_cors::{Cors, Guard, AllowedOrigins, AllowedHeaders};
|
||||
|
@ -545,9 +548,7 @@
|
|||
)]
|
||||
#![doc(test(attr(allow(unused_variables), deny(warnings))))]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
extern crate unicase;
|
||||
extern crate url;
|
||||
|
@ -555,7 +556,6 @@ extern crate url;
|
|||
#[cfg(feature = "serialization")]
|
||||
extern crate serde;
|
||||
#[cfg(feature = "serialization")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
#[cfg(feature = "serialization")]
|
||||
extern crate unicase_serde;
|
||||
|
@ -586,10 +586,13 @@ use std::marker::PhantomData;
|
|||
use std::ops::Deref;
|
||||
use std::str::FromStr;
|
||||
|
||||
use log::{error, info, log};
|
||||
use rocket::http::{self, Status};
|
||||
use rocket::request::{FromRequest, Request};
|
||||
use rocket::response;
|
||||
use rocket::{Outcome, State};
|
||||
use rocket::{error_, info_, log_, Outcome, State};
|
||||
#[cfg(feature = "serialization")]
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::headers::{
|
||||
AccessControlRequestHeaders, AccessControlRequestMethod, HeaderFieldName, HeaderFieldNamesSet,
|
||||
|
|
Loading…
Reference in New Issue