From dcde2246489e7f7996caa0bdf0b99cdb62f6e44a Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Thu, 11 Apr 2024 18:09:21 -0700 Subject: [PATCH] Update dependencies and fix nightly warnings. --- benchmarks/Cargo.toml | 2 +- core/codegen/src/attribute/route/mod.rs | 20 ++++++++++++------- core/codegen/src/bang/uri.rs | 6 +++--- core/lib/Cargo.toml | 2 +- core/lib/src/outcome.rs | 26 ++++++++++++------------- examples/state/Cargo.toml | 2 +- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 2a497057..db9d42f3 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -13,4 +13,4 @@ harness = false [dev-dependencies] rocket = { path = "../core/lib/" } -criterion = "0.4" +criterion = "0.5.1" diff --git a/core/codegen/src/attribute/route/mod.rs b/core/codegen/src/attribute/route/mod.rs index 36fd9559..b5fb5968 100644 --- a/core/codegen/src/attribute/route/mod.rs +++ b/core/codegen/src/attribute/route/mod.rs @@ -218,17 +218,23 @@ fn internal_uri_macro_decl(route: &Route) -> TokenStream { quote_spanned! { Span::call_site() => #[doc(hidden)] - #[macro_export] - /// Rocket generated URI macro. - macro_rules! #inner_macro_name { - ($($token:tt)*) => {{ - rocket::rocket_internal_uri!(#route_uri, (#(#uri_args),*), $($token)*) - }}; + #[allow(nonstandard_style, unused)] + pub mod #inner_macro_name { + #[doc(hidden)] + #[macro_export] + /// Rocket generated URI macro. + macro_rules! #inner_macro_name { + ($($token:tt)*) => {{ + rocket::rocket_internal_uri!(#route_uri, (#(#uri_args),*), $($token)*) + }}; + } + + pub use #inner_macro_name as #macro_name; } #[doc(hidden)] #[allow(unused)] - pub use #inner_macro_name as #macro_name; + pub use #inner_macro_name::#macro_name; } } diff --git a/core/codegen/src/bang/uri.rs b/core/codegen/src/bang/uri.rs index 12f40cea..b711d458 100644 --- a/core/codegen/src/bang/uri.rs +++ b/core/codegen/src/bang/uri.rs @@ -61,14 +61,14 @@ fn extract_exprs(internal: &InternalUriParams) -> Result<( let types = internal.fn_args.iter().map(|a| (&a.ident, &a.ty)); Ok((path_exprs, query_exprs, types)) } - Validation::NamedIgnored(_) => { + Validation::NamedIgnored(args) => { let mut route_name = quote!(#route_name).to_string(); route_name.retain(|c| !c.is_whitespace()); let diag = internal.uri_mac.args_span() .error("expected unnamed arguments due to ignored parameters") - .note(format!("uri for route `{}` ignores path parameters: \"{}\"", - route_name, internal.route_uri)); + .note(format!("uri for route `{}` ignores {} path parameters: \"{}\"", + route_name, args.len(), internal.route_uri)); Err(diag) } diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index bfe6b67a..4f08113e 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -123,7 +123,7 @@ version = "2.1.0" optional = true [dependencies.s2n-quic] -version = "1.32" +version = "1.36" default-features = false features = ["provider-address-token-default", "provider-tls-rustls"] optional = true diff --git a/core/lib/src/outcome.rs b/core/lib/src/outcome.rs index 88828b36..98debf30 100644 --- a/core/lib/src/outcome.rs +++ b/core/lib/src/outcome.rs @@ -732,21 +732,21 @@ impl Outcome { pub(crate) struct Display<'a, 'r>(&'a route::Outcome<'r>); +impl fmt::Display for Display<'_, '_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", "Outcome: ".primary().bold())?; + + let color = self.0.color(); + match self.0 { + Success(r) => write!(f, "{}({})", "Success".paint(color), r.status().primary()), + Error(s) => write!(f, "{}({})", "Error".paint(color), s.primary()), + Forward((_, s)) => write!(f, "{}({})", "Forward".paint(color), s.primary()), + } + } +} + impl<'r> route::Outcome<'r> { pub(crate) fn log_display(&self) -> Display<'_, 'r> { - impl fmt::Display for Display<'_, '_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", "Outcome: ".primary().bold())?; - - let color = self.0.color(); - match self.0 { - Success(r) => write!(f, "{}({})", "Success".paint(color), r.status().primary()), - Error(s) => write!(f, "{}({})", "Error".paint(color), s.primary()), - Forward((_, s)) => write!(f, "{}({})", "Forward".paint(color), s.primary()), - } - } - } - Display(self) } } diff --git a/examples/state/Cargo.toml b/examples/state/Cargo.toml index c2f518f5..ce04c462 100644 --- a/examples/state/Cargo.toml +++ b/examples/state/Cargo.toml @@ -7,4 +7,4 @@ publish = false [dependencies] rocket = { path = "../../core/lib" } -flume = "0.10" +flume = "0.11"