Skip to content

Commit

Permalink
Add macro imports and #![feature(proc_macro_non_items)] to examples a…
Browse files Browse the repository at this point in the history
…nd tests
  • Loading branch information
jebrosen committed Jul 9, 2018
1 parent 89f2487 commit 5f88331
Show file tree
Hide file tree
Showing 68 changed files with 141 additions and 61 deletions.
3 changes: 2 additions & 1 deletion core/codegen/tests/complete-decorator.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]
#![allow(dead_code, unused_variables)]

extern crate rocket;

use rocket::routes;
use rocket::http::{Cookies, RawStr};
use rocket::request::Form;

Expand Down
4 changes: 3 additions & 1 deletion core/codegen/tests/dynamic-paths.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]
#![allow(dead_code, unused_variables)]

extern crate rocket;

use rocket::routes;

#[get("/test/<one>/<two>/<three>")]
fn get(one: String, two: usize, three: isize) -> &'static str { "hi" }

Expand Down
4 changes: 3 additions & 1 deletion core/codegen/tests/instanced-mounting.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]
#![allow(dead_code, unused_variables)]

extern crate rocket;

use rocket::routes;

#[get("/one")]
fn one() { }

Expand Down
4 changes: 3 additions & 1 deletion core/codegen/tests/issue-1-colliding-names.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;

#[get("/<todo>")]
fn todo(todo: String) -> String {
todo
Expand Down
3 changes: 2 additions & 1 deletion core/codegen/tests/refactored_rocket_no_lint_errors.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]
#![allow(dead_code, unused_variables)]

extern crate rocket;

use rocket::routes;
use rocket::{Rocket, State};

#[get("/")]
Expand Down
3 changes: 2 additions & 1 deletion core/codegen/tests/type-alias-lints.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]
#![allow(dead_code, unused_variables)]

extern crate rocket;

use rocket::routes;
use rocket::State;

type MyState<'r> = State<'r, usize>;
Expand Down
3 changes: 2 additions & 1 deletion core/lib/src/catcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ use yansi::Color::*;
/// declared using the `catch` decorator, as follows:
///
/// ```rust
/// #![feature(plugin, decl_macro)]
/// #![feature(plugin, decl_macro, proc_macro_non_items)]
/// #![plugin(rocket_codegen)]
///
/// extern crate rocket;
///
/// use rocket::catchers;
/// use rocket::Request;
///
/// #[catch(500)]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@
//! write Rocket applications. Here's a simple example to get you started:
//!
//! ```rust
//! #![feature(plugin, decl_macro)]
//! #![feature(plugin, decl_macro, proc_macro_non_items)]
//! #![plugin(rocket_codegen)]
//!
//! extern crate rocket;
//! use rocket::routes;
//!
//! #[get("/")]
//! fn hello() -> &'static str {
Expand Down
3 changes: 2 additions & 1 deletion core/lib/src/request/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ use http::Status;
/// following example does just this:
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
/// # #![feature(plugin, decl_macro, proc_macro_non_items)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::routes;
/// use rocket::State;
///
/// // In a real application, this would likely be more complex.
Expand Down
3 changes: 2 additions & 1 deletion core/lib/src/response/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ const FLASH_COOKIE_NAME: &'static str = "_flash";
/// message on both the request and response sides.
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
/// # #![feature(plugin, decl_macro, proc_macro_non_items)]
/// # #![plugin(rocket_codegen)]
/// #
/// # extern crate rocket;
/// # use rocket::routes;
/// #
/// use rocket::response::{Flash, Redirect};
/// use rocket::request::FlashMessage;
Expand Down
12 changes: 8 additions & 4 deletions core/lib/src/rocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,10 @@ impl Rocket {
/// dispatched to the `hi` route.
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
/// # #![feature(plugin, decl_macro, proc_macro_non_items)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::routes;
/// #
/// #[get("/world")]
/// fn hi() -> &'static str {
Expand Down Expand Up @@ -510,11 +511,12 @@ impl Rocket {
/// # Examples
///
/// ```rust
/// #![feature(plugin, decl_macro)]
/// #![feature(plugin, decl_macro, proc_macro_non_items)]
/// #![plugin(rocket_codegen)]
///
/// extern crate rocket;
///
/// use rocket::catchers;
/// use rocket::Request;
///
/// #[catch(500)]
Expand Down Expand Up @@ -569,9 +571,10 @@ impl Rocket {
/// # Example
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
/// # #![feature(plugin, decl_macro, proc_macro_non_items)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::routes;
/// use rocket::State;
///
/// struct MyValue(usize);
Expand Down Expand Up @@ -720,9 +723,10 @@ impl Rocket {
/// # Example
///
/// ```rust
/// # #![feature(plugin, decl_macro)]
/// # #![feature(plugin, decl_macro, proc_macro_non_items)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::routes;
/// use rocket::Rocket;
/// use rocket::fairing::AdHoc;
///
Expand Down
4 changes: 3 additions & 1 deletion core/lib/tests/fairing_before_head_strip-issue-546.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;

const RESPONSE_STRING: &'static str = "This is the body. Hello, world!";

#[head("/")]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/flash-lazy-removes-issue-466.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::request::FlashMessage;
use rocket::response::Flash;

Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/form_method-issue-45.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::request::Form;

#[derive(FromForm)]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/form_value_decoding-issue-82.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::request::Form;

#[derive(FromForm)]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/head_handling.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::response::{status, content};

#[get("/empty")]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/limits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;
Expand All @@ -17,6 +17,7 @@ fn index(form: Form<Simple>) -> String {

mod limits_tests {
use rocket;
use rocket::routes;
use rocket::config::{Environment, Config, Limits};
use rocket::local::Client;
use rocket::http::{Status, ContentType};
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/local-request-content-type-issue-505.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::Outcome::*;
use rocket::{Request, Data};
use rocket::request::{self, FromRequest};
Expand Down
5 changes: 3 additions & 2 deletions core/lib/tests/local_request_private_cookie-issue-368.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::http::Cookies;

#[get("/")]
Expand Down Expand Up @@ -41,4 +42,4 @@ mod tests {

assert_eq!(response.status(), Status::NotFound);
}
}
}
3 changes: 2 additions & 1 deletion core/lib/tests/nested-fairing-attaches.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use std::sync::atomic::{AtomicUsize, Ordering};

use rocket::routes;
use rocket::State;
use rocket::fairing::AdHoc;
use rocket::http::Method;
Expand Down
4 changes: 3 additions & 1 deletion core/lib/tests/precise-content-type-matching.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;

#[post("/", format = "application/json")]
fn specified() -> &'static str {
"specified"
Expand Down
4 changes: 3 additions & 1 deletion core/lib/tests/query-and-non-query-dont-collide.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;

#[derive(FromForm)]
struct Query {
field: String
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/redirect_from_catcher-issue-113.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::catchers;
use rocket::response::Redirect;

#[catch(404)]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/route_guard.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use std::path::PathBuf;
use rocket::routes;
use rocket::Route;

#[get("/<path..>")]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/segments-issues-41-86.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::http::uri::Segments;

#[get("/test/<path..>")]
Expand Down
3 changes: 2 additions & 1 deletion core/lib/tests/strict_and_lenient_forms.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![feature(plugin, decl_macro, custom_derive)]
#![feature(plugin, decl_macro, custom_derive, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;

use rocket::routes;
use rocket::request::{Form, LenientForm};
use rocket::http::RawStr;

Expand Down
1 change: 1 addition & 0 deletions examples/config/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rocket::routes;
use rocket::{self, State};
use rocket::fairing::AdHoc;
use rocket::config::{self, Config, Environment, LoggingLevel};
Expand Down
2 changes: 1 addition & 1 deletion examples/config/tests/development.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;
Expand Down
2 changes: 1 addition & 1 deletion examples/config/tests/production.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;
Expand Down
2 changes: 1 addition & 1 deletion examples/config/tests/staging.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;
Expand Down
3 changes: 2 additions & 1 deletion examples/content_types/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(plugin, decl_macro)]
#![feature(plugin, decl_macro, proc_macro_non_items)]
#![plugin(rocket_codegen)]

extern crate rocket;
Expand All @@ -8,6 +8,7 @@ extern crate serde_derive;

#[cfg(test)] mod tests;

use rocket::{routes, catchers};
use rocket::Request;
use rocket::response::content;

Expand Down
Loading

0 comments on commit 5f88331

Please sign in to comment.