mirror of https://github.com/rwf2/Rocket.git
Address new nightly compiler warnings.
This commit is contained in:
parent
1619bbbddc
commit
d9249db6d6
|
@ -1,6 +1,8 @@
|
|||
#[cfg(all(feature = "diesel_sqlite_pool", feature = "diesel_postgres_pool"))]
|
||||
mod databases_tests {
|
||||
use rocket_sync_db_pools::{database, diesel};
|
||||
#![allow(dead_code)]
|
||||
|
||||
use rocket_sync_db_pools::database;
|
||||
|
||||
#[database("example")]
|
||||
struct ExampleDb(diesel::SqliteConnection);
|
||||
|
|
|
@ -5,6 +5,7 @@ mod sqlite_shutdown_test {
|
|||
use rocket_sync_db_pools::database;
|
||||
|
||||
#[database("test")]
|
||||
#[allow(dead_code)]
|
||||
struct Pool(diesel::SqliteConnection);
|
||||
|
||||
async fn rocket() -> Rocket<Build> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::path::Path;
|
||||
use std::error::Error;
|
||||
|
||||
use syn::{self, Ident, LitStr};
|
||||
use syn::{Ident, LitStr};
|
||||
use devise::ext::SpanDiagnosticExt;
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::http::uncased::UncasedStr;
|
||||
|
||||
use syn::{self, Ident, ext::IdentExt};
|
||||
use syn::{Ident, ext::IdentExt};
|
||||
use proc_macro2::{Span, TokenStream};
|
||||
|
||||
/// A "name" read by codegen, which may or may not be an identifier. A `Name` is
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::ops::Deref;
|
|||
use std::hash::{Hash, Hasher};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use syn::{self, Ident, ext::IdentExt as _, visit::Visit};
|
||||
use syn::{Ident, ext::IdentExt as _, visit::Visit};
|
||||
use proc_macro2::{Span, TokenStream};
|
||||
use devise::ext::{PathExt, TypeExt as _};
|
||||
use rocket_http::ext::IntoOwned;
|
||||
|
@ -21,17 +21,12 @@ pub trait ReturnTypeExt {
|
|||
fn ty(&self) -> Option<&syn::Type>;
|
||||
}
|
||||
|
||||
pub trait TokenStreamExt {
|
||||
fn respanned(&self, span: Span) -> Self;
|
||||
}
|
||||
|
||||
pub trait FnArgExt {
|
||||
fn typed(&self) -> Option<(&syn::Ident, &syn::Type)>;
|
||||
fn wild(&self) -> Option<&syn::PatWild>;
|
||||
}
|
||||
|
||||
pub trait TypeExt {
|
||||
fn unfold(&self) -> Vec<Child<'_>>;
|
||||
fn unfold_with_ty_macros(&self, names: &[&str], mapper: MacTyMapFn) -> Vec<Child<'_>>;
|
||||
fn is_concrete(&self, generic_ident: &[&Ident]) -> bool;
|
||||
}
|
||||
|
@ -112,15 +107,6 @@ impl ReturnTypeExt for syn::ReturnType {
|
|||
}
|
||||
}
|
||||
|
||||
impl TokenStreamExt for TokenStream {
|
||||
fn respanned(&self, span: Span) -> Self {
|
||||
self.clone().into_iter().map(|mut token| {
|
||||
token.set_span(span);
|
||||
token
|
||||
}).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl FnArgExt for syn::FnArg {
|
||||
fn typed(&self) -> Option<(&Ident, &syn::Type)> {
|
||||
match self {
|
||||
|
@ -154,10 +140,6 @@ fn macro_inner_ty(t: &syn::TypeMacro, names: &[&str], m: MacTyMapFn) -> Option<s
|
|||
}
|
||||
|
||||
impl TypeExt for syn::Type {
|
||||
fn unfold(&self) -> Vec<Child<'_>> {
|
||||
self.unfold_with_ty_macros(&[], |_| None)
|
||||
}
|
||||
|
||||
fn unfold_with_ty_macros(&self, names: &[&str], mapper: MacTyMapFn) -> Vec<Child<'_>> {
|
||||
struct Visitor<'a, 'm> {
|
||||
parents: Vec<Cow<'a, syn::Type>>,
|
||||
|
@ -240,10 +222,10 @@ impl GenericsExt for syn::Generics {
|
|||
mod tests {
|
||||
#[test]
|
||||
fn test_type_unfold_is_generic() {
|
||||
use super::{TypeExt, syn};
|
||||
use super::TypeExt;
|
||||
|
||||
let ty: syn::Type = syn::parse_quote!(A<B, C<impl Foo>, Box<dyn Foo>, Option<T>>);
|
||||
let children = ty.unfold();
|
||||
let children = ty.unfold_with_ty_macros(&[], |_| None);
|
||||
assert_eq!(children.len(), 8);
|
||||
|
||||
let gen_ident = format_ident!("T");
|
||||
|
|
|
@ -135,7 +135,6 @@ impl fmt::Display for Method {
|
|||
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
use std::fmt;
|
||||
use super::*;
|
||||
|
||||
use serde_::ser::{Serialize, Serializer};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use crate::uri::{Origin, Authority, Absolute, Asterisk};
|
||||
use crate::parse::uri::*;
|
||||
|
||||
macro_rules! assert_parse_eq {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use std::fmt;
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::convert::AsRef;
|
||||
use std::cmp::Ordering;
|
||||
use std::str::Utf8Error;
|
||||
use std::fmt;
|
||||
|
||||
use ref_cast::RefCast;
|
||||
use stable_pattern::{Pattern, Searcher, ReverseSearcher, Split, SplitInternal};
|
||||
use crate::uri::fmt::{DEFAULT_ENCODE_SET, percent_encode, percent_encode_bytes};
|
||||
|
||||
use crate::uncased::UncasedStr;
|
||||
use crate::uri::fmt::{DEFAULT_ENCODE_SET, percent_encode, percent_encode_bytes};
|
||||
|
||||
/// A reference to a string inside of a raw HTTP message.
|
||||
///
|
||||
|
|
|
@ -382,7 +382,6 @@ impl Ord for Status {
|
|||
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
use std::fmt;
|
||||
use super::*;
|
||||
|
||||
use serde_::ser::{Serialize, Serializer};
|
||||
|
|
|
@ -4,8 +4,7 @@ use crate::Request;
|
|||
use crate::outcome::try_outcome;
|
||||
use crate::data::{Data, FromData, Outcome};
|
||||
use crate::http::{RawStr, ext::IntoOwned};
|
||||
use crate::form::{SharedStack, parser::{Parser, RawStrParser}};
|
||||
use crate::form::prelude::*;
|
||||
use crate::form::prelude::{*, parser::{Parser, RawStrParser}};
|
||||
|
||||
/// A data guard for [`FromForm`] types.
|
||||
///
|
||||
|
|
|
@ -3,8 +3,8 @@ use either::Either;
|
|||
|
||||
use crate::request::{Request, local_cache_once};
|
||||
use crate::data::{Data, Limits, Outcome};
|
||||
use crate::form::{SharedStack, prelude::*};
|
||||
use crate::http::{RawStr, Status};
|
||||
use crate::form::prelude::*;
|
||||
|
||||
type Result<'r, T> = std::result::Result<T, Error<'r>>;
|
||||
|
||||
|
|
|
@ -447,7 +447,6 @@ pub mod resolution {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::any::TypeId;
|
||||
use crate::sentinel::resolve;
|
||||
|
||||
struct NotASentinel;
|
||||
struct YesASentinel;
|
||||
|
|
|
@ -7,7 +7,7 @@ use indexmap::IndexMap;
|
|||
use rocket_http::{ext::IntoCollection, private::SmallVec};
|
||||
use time::Duration;
|
||||
|
||||
use crate::http::{Header, uri::Absolute, uncased::{UncasedStr, Uncased}};
|
||||
use crate::http::{Header, uri::Absolute, uncased::Uncased};
|
||||
|
||||
/// Trait implemented by security and privacy policy headers.
|
||||
///
|
||||
|
@ -64,22 +64,6 @@ pub trait Policy: Default + Send + Sync + 'static {
|
|||
fn header(&self) -> Header<'static>;
|
||||
}
|
||||
|
||||
/// Hack to make `Policy` Object-Safe.
|
||||
pub(crate) trait SubPolicy: Send + Sync {
|
||||
fn name(&self) -> &'static UncasedStr;
|
||||
fn header(&self) -> Header<'static>;
|
||||
}
|
||||
|
||||
impl<P: Policy> SubPolicy for P {
|
||||
fn name(&self) -> &'static UncasedStr {
|
||||
P::NAME.into()
|
||||
}
|
||||
|
||||
fn header(&self) -> Header<'static> {
|
||||
Policy::header(self)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_policy {
|
||||
($T:ty, $name:expr) => (
|
||||
impl Policy for $T {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use rocket;
|
||||
|
||||
use rocket::{get, routes};
|
||||
use rocket::form::{FromForm, FromFormField};
|
||||
use rocket::response::Responder;
|
||||
|
|
|
@ -56,9 +56,10 @@ fn catcher() -> &'static str {
|
|||
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use rocket::routes;
|
||||
use rocket::local::blocking::Client;
|
||||
use rocket::http::{Header, Status};
|
||||
use rocket::http::Header;
|
||||
|
||||
#[test]
|
||||
fn authorized_forwards() {
|
||||
|
|
|
@ -23,7 +23,7 @@ mod head_handling_tests {
|
|||
|
||||
use rocket::Route;
|
||||
use rocket::local::blocking::Client;
|
||||
use rocket::http::{Status, ContentType};
|
||||
use rocket::http::ContentType;
|
||||
|
||||
fn routes() -> Vec<Route> {
|
||||
routes![index, empty, other]
|
||||
|
|
Loading…
Reference in New Issue