diff --git a/src/lib.rs b/src/lib.rs index 4abbabc..eed63d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1154,55 +1154,55 @@ impl CorsOptions { } /// Sets the allowed origins - pub fn allowed_origins(&mut self, allowed_origins: AllowedOrigins) -> &mut Self { + pub fn allowed_origins(mut self, allowed_origins: AllowedOrigins) -> Self { self.allowed_origins = allowed_origins; self } /// Sets the allowed methodes - pub fn allowed_methods(&mut self, allowed_methods: AllowedMethods) -> &mut Self { + pub fn allowed_methods(mut self, allowed_methods: AllowedMethods) -> Self { self.allowed_methods = allowed_methods; self } /// Sets the allowed headers - pub fn allowed_headers(&mut self, allowed_headers: AllowedHeaders) -> &mut Self { + pub fn allowed_headers(mut self, allowed_headers: AllowedHeaders) -> Self { self.allowed_headers = allowed_headers; self } /// Marks if credentials are allowed - pub fn allow_credentials(&mut self, allow_credentials: bool) -> &mut Self { + pub fn allow_credentials(mut self, allow_credentials: bool) -> Self { self.allow_credentials = allow_credentials; self } /// Sets the expose headers - pub fn expose_headers(&mut self, expose_headers: HashSet) -> &mut Self { + pub fn expose_headers(mut self, expose_headers: HashSet) -> Self { self.expose_headers = expose_headers; self } /// Sets the max age - pub fn max_age(&mut self, max_age: Option) -> &mut Self { + pub fn max_age(mut self, max_age: Option) -> Self { self.max_age = max_age; self } /// Marks if wildcards are send - pub fn send_wildcard(&mut self, send_wildcard: bool) -> &mut Self { + pub fn send_wildcard(mut self, send_wildcard: bool) -> Self { self.send_wildcard = send_wildcard; self } /// Sets the base of the fairing route - pub fn fairing_route_base>(&mut self, fairing_route_base: S) -> &mut Self { + pub fn fairing_route_base>(mut self, fairing_route_base: S) -> Self { self.fairing_route_base = fairing_route_base.into(); self } /// Sets the rank of the fairing route - pub fn fairing_route_rank(&mut self, fairing_route_rank: isize) -> &mut Self { + pub fn fairing_route_rank(mut self, fairing_route_rank: isize) -> Self { self.fairing_route_rank = fairing_route_rank; self } @@ -2082,8 +2082,8 @@ mod tests { #[test] fn cors_options_from_builder_pattern() { let allowed_origins = AllowedOrigins::some_exact(&["https://www.acme.com"]); - let mut cors_options_from_builder = CorsOptions::default(); - let _ = cors_options_from_builder.allowed_origins(allowed_origins) + let cors_options_from_builder = CorsOptions::default() + .allowed_origins(allowed_origins) .allowed_methods(vec![http::Method::Get].into_iter().map(From::from).collect()) .allowed_headers(AllowedHeaders::some(&[&"Authorization", "Accept"])) .allow_credentials(true)