diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index ff9ed1af..00b624df 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -3,10 +3,10 @@ # This file was generated using a Jinja2 template. # Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfiles. -{% set build_stage_base_image = "rust:1.55-buster" %} +{% set build_stage_base_image = "rust:1.56-buster" %} {% if "alpine" in target_file %} {% if "amd64" in target_file %} -{% set build_stage_base_image = "clux/muslrust:nightly-2021-10-23" %} +{% set build_stage_base_image = "clux/muslrust:stable" %} {% set runtime_stage_base_image = "alpine:3.14" %} {% set package_arch_target = "x86_64-unknown-linux-musl" %} {% elif "armv7" in target_file %} @@ -268,7 +268,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault {% if package_arch_target is defined %} COPY --from=build /app/target/{{ package_arch_target }}/release/vaultwarden . @@ -282,5 +281,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/amd64/Dockerfile b/docker/amd64/Dockerfile index 8ec84d8c..aa28f19e 100644 --- a/docker/amd64/Dockerfile +++ b/docker/amd64/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -112,7 +112,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/release/vaultwarden . @@ -122,5 +121,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/amd64/Dockerfile.alpine b/docker/amd64/Dockerfile.alpine index 974600e0..41dcce17 100644 --- a/docker/amd64/Dockerfile.alpine +++ b/docker/amd64/Dockerfile.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM clux/muslrust:nightly-2021-10-23 as build +FROM clux/muslrust:stable as build # Alpine-based AMD64 (musl) does not support mysql/mariadb during compile time. ARG DB=sqlite,postgresql @@ -104,7 +104,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/x86_64-unknown-linux-musl/release/vaultwarden . @@ -114,5 +113,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/amd64/Dockerfile.buildx b/docker/amd64/Dockerfile.buildx index 62a036b0..af42b76c 100644 --- a/docker/amd64/Dockerfile.buildx +++ b/docker/amd64/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -112,7 +112,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/release/vaultwarden . @@ -122,5 +121,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/amd64/Dockerfile.buildx.alpine b/docker/amd64/Dockerfile.buildx.alpine index 60dc2518..db865329 100644 --- a/docker/amd64/Dockerfile.buildx.alpine +++ b/docker/amd64/Dockerfile.buildx.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM clux/muslrust:nightly-2021-10-23 as build +FROM clux/muslrust:stable as build # Alpine-based AMD64 (musl) does not support mysql/mariadb during compile time. ARG DB=sqlite,postgresql @@ -104,7 +104,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/x86_64-unknown-linux-musl/release/vaultwarden . @@ -114,5 +113,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile index 4357e59f..0c38e5ce 100644 --- a/docker/arm64/Dockerfile +++ b/docker/arm64/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/aarch64-unknown-linux-gnu/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/arm64/Dockerfile.buildx b/docker/arm64/Dockerfile.buildx index e1aeb59c..df9a44a2 100644 --- a/docker/arm64/Dockerfile.buildx +++ b/docker/arm64/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/aarch64-unknown-linux-gnu/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv6/Dockerfile b/docker/armv6/Dockerfile index 4062062d..5a524295 100644 --- a/docker/armv6/Dockerfile +++ b/docker/armv6/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/arm-unknown-linux-gnueabi/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv6/Dockerfile.buildx b/docker/armv6/Dockerfile.buildx index 6c672455..136fc429 100644 --- a/docker/armv6/Dockerfile.buildx +++ b/docker/armv6/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/arm-unknown-linux-gnueabi/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv7/Dockerfile b/docker/armv7/Dockerfile index 7e456fd7..d38be097 100644 --- a/docker/armv7/Dockerfile +++ b/docker/armv7/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/armv7-unknown-linux-gnueabihf/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv7/Dockerfile.alpine b/docker/armv7/Dockerfile.alpine index 6e62cedf..404d090f 100644 --- a/docker/armv7/Dockerfile.alpine +++ b/docker/armv7/Dockerfile.alpine @@ -111,7 +111,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/armv7-unknown-linux-musleabihf/release/vaultwarden . @@ -121,5 +120,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv7/Dockerfile.buildx b/docker/armv7/Dockerfile.buildx index 8d9e938b..33834022 100644 --- a/docker/armv7/Dockerfile.buildx +++ b/docker/armv7/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:0e8daf80abb73ebca69d1971847450d24da45a74a525fd643246ee1dfa02108b as vault ########################## BUILD IMAGE ########################## -FROM rust:1.55-buster as build +FROM rust:1.56-buster as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql @@ -155,7 +155,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/armv7-unknown-linux-gnueabihf/release/vaultwarden . @@ -165,5 +164,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/docker/armv7/Dockerfile.buildx.alpine b/docker/armv7/Dockerfile.buildx.alpine index f235b09a..461ac193 100644 --- a/docker/armv7/Dockerfile.buildx.alpine +++ b/docker/armv7/Dockerfile.buildx.alpine @@ -111,7 +111,6 @@ EXPOSE 3012 # Copies the files from the context (Rocket.toml file and web-vault) # and the binary from the "build" stage to the current stage WORKDIR / -COPY Rocket.toml . COPY --from=vault /web-vault ./web-vault COPY --from=build /app/target/armv7-unknown-linux-musleabihf/release/vaultwarden . @@ -121,5 +120,9 @@ COPY docker/start.sh /start.sh HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"] # Configures the startup! +# We should be able to remove the dumb-init now with Rocket 0.5 +# But the balenalib images have some issues with there entry.sh +# See: https://github.com/balena-io-library/base-images/issues/735 +# Lets keep using dumb-init for now, since that is working fine. ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/start.sh"] diff --git a/src/api/admin.rs b/src/api/admin.rs index 43376e19..1dd0fdc0 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -142,7 +142,7 @@ fn admin_url(referer: Referer) -> String { } #[get("/", rank = 2)] -fn admin_login(flash: Option) -> ApiResult> { +fn admin_login(flash: Option>) -> ApiResult> { // If there is an error, show it let msg = flash.map(|msg| format!("{}: {}", msg.kind(), msg.message())); let json = json!({ @@ -165,7 +165,7 @@ struct LoginForm { #[post("/", data = "")] fn post_admin_login( data: Form, - cookies: &CookieJar, + cookies: &CookieJar<'_>, ip: ClientIp, referer: Referer, ) -> Result> { @@ -297,7 +297,7 @@ fn test_smtp(data: Json, _token: AdminToken) -> EmptyResult { } #[get("/logout")] -fn logout(cookies: &CookieJar, referer: Referer) -> Redirect { +fn logout(cookies: &CookieJar<'_>, referer: Referer) -> Redirect { cookies.remove(Cookie::named(COOKIE_NAME)); Redirect::to(admin_url(referer)) } diff --git a/src/auth.rs b/src/auth.rs index 7eaf1494..a2d64b30 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -38,7 +38,7 @@ static PRIVATE_RSA_KEY: Lazy = Lazy::new(|| { static PUBLIC_RSA_KEY_VEC: Lazy> = Lazy::new(|| { read_file(&CONFIG.public_rsa_key()).unwrap_or_else(|e| panic!("Error loading public RSA Key.\n{}", e)) }); -static PUBLIC_RSA_KEY: Lazy = Lazy::new(|| { +static PUBLIC_RSA_KEY: Lazy> = Lazy::new(|| { DecodingKey::from_rsa_pem(&PUBLIC_RSA_KEY_VEC).unwrap_or_else(|e| panic!("Error decoding public RSA Key.\n{}", e)) }); @@ -411,7 +411,7 @@ pub struct OrgHeaders { // org_id is usually the second path param ("/organizations/"), // but there are cases where it is a query value. // First check the path, if this is not a valid uuid, try the query values. -fn get_org_id(request: &Request) -> Option { +fn get_org_id(request: &Request<'_>) -> Option { if let Some(Ok(org_id)) = request.param::(1) { if uuid::Uuid::parse_str(&org_id).is_ok() { return Some(org_id); @@ -512,7 +512,7 @@ impl From for Headers { // col_id is usually the fourth path param ("/organizations//collections/"), // but there could be cases where it is a query value. // First check the path, if this is not a valid uuid, try the query values. -fn get_col_id(request: &Request) -> Option { +fn get_col_id(request: &Request<'_>) -> Option { if let Some(Ok(col_id)) = request.param::(3) { if uuid::Uuid::parse_str(&col_id).is_ok() { return Some(col_id); diff --git a/src/config.rs b/src/config.rs index cccfadff..9b40ceda 100644 --- a/src/config.rs +++ b/src/config.rs @@ -969,7 +969,7 @@ where fn case_helper<'reg, 'rc>( h: &Helper<'reg, 'rc>, - r: &'reg Handlebars, + r: &'reg Handlebars<'_>, ctx: &'rc Context, rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output, @@ -986,7 +986,7 @@ fn case_helper<'reg, 'rc>( fn js_escape_helper<'reg, 'rc>( h: &Helper<'reg, 'rc>, - _r: &'reg Handlebars, + _r: &'reg Handlebars<'_>, _ctx: &'rc Context, _rc: &mut RenderContext<'reg, 'rc>, out: &mut dyn Output, diff --git a/src/error.rs b/src/error.rs index 6c94c422..fe1ae1ab 100644 --- a/src/error.rs +++ b/src/error.rs @@ -24,7 +24,7 @@ macro_rules! make_error { } } impl std::fmt::Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match &self.error {$( ErrorKind::$name(e) => f.write_str(&$usr_msg_fun(e, &self.message)), )+} @@ -93,7 +93,7 @@ make_error! { } impl std::fmt::Debug for Error { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self.source() { Some(e) => write!(f, "{}.\n[CAUSE] {:#?}", self.message, e), None => match self.error { @@ -194,7 +194,7 @@ use rocket::request::Request; use rocket::response::{self, Responder, Response}; impl<'r> Responder<'r, 'static> for Error { - fn respond_to(self, _: &Request) -> response::Result<'static> { + fn respond_to(self, _: &Request<'_>) -> response::Result<'static> { match self.error { ErrorKind::Empty(_) => {} // Don't print the error in this situation ErrorKind::Simple(_) => {} // Don't print the error in this situation diff --git a/src/main.rs b/src/main.rs index 17a27f57..37ef81e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #![forbid(unsafe_code)] -// #![warn(rust_2018_idioms)] +#![warn(rust_2018_idioms)] #![warn(rust_2021_compatibility)] #![cfg_attr(feature = "unstable", feature(ip))] // The recursion_limit is mainly triggered by the json!() macro. @@ -8,7 +8,6 @@ // If you go above 128 it will cause rust-analyzer to fail, #![recursion_limit = "87"] -extern crate openssl; #[macro_use] extern crate rocket; #[macro_use] diff --git a/src/util.rs b/src/util.rs index b0e4fa05..99f7be64 100644 --- a/src/util.rs +++ b/src/util.rs @@ -49,7 +49,7 @@ impl Fairing for AppHeaders { pub struct Cors(); impl Cors { - fn get_header(headers: &HeaderMap, name: &str) -> String { + fn get_header(headers: &HeaderMap<'_>, name: &str) -> String { match headers.get_one(name) { Some(h) => h.to_string(), _ => "".to_string(), @@ -58,7 +58,7 @@ impl Cors { // Check a request's `Origin` header against the list of allowed origins. // If a match exists, return it. Otherwise, return None. - fn get_allowed_origin(headers: &HeaderMap) -> Option { + fn get_allowed_origin(headers: &HeaderMap<'_>) -> Option { let origin = Cors::get_header(headers, "Origin"); let domain_origin = CONFIG.domain_origin(); let safari_extension_origin = "file://"; @@ -130,7 +130,7 @@ impl<'r, R: 'r + Responder<'r, 'static> + Send> Responder<'r, 'static> for Cache pub struct SafeString(String); impl std::fmt::Display for SafeString { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.0.fmt(f) } } @@ -462,7 +462,7 @@ struct UpCaseVisitor; impl<'de> Visitor<'de> for UpCaseVisitor { type Value = Value; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("an object or an array") }