index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-09-15 7:10:30.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-09-15 7:10:30.0 +00:00:00
commit
906106fdf038b1a5a54bc56eddbfbab3c0cd0f49 [patch]
tree
d1e4bea83170982438443b8d788fecc4592d3586
parent
78a924a67ba52e6fc98ef65001a4d9226eeb5c59
download
906106fdf038b1a5a54bc56eddbfbab3c0cd0f49.tar.gz

refactor: field `origins_str` is never read on cors module



Diff

 src/cors.rs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/cors.rs b/src/cors.rs
index 0992a46..5bc48fa 100644
--- a/src/cors.rs
+++ b/src/cors.rs
@@ -11,13 +11,12 @@ pub struct Cors {
    allowed_headers: HashSet<HeaderName>,
    max_age: Option<u64>,
    allowed_methods: HashSet<http::Method>,
    origins_str: String,
    origins: Option<HashSet<HeaderValue>>,
}

/// It builds a new CORS instance.
pub fn new(origins_str: String) -> Option<Arc<Configured>> {
    let cors = Cors::new(origins_str.clone());
    let cors = Cors::new();
    let cors = if origins_str.is_empty() {
        None
    } else if origins_str == "*" {
@@ -41,13 +40,12 @@ pub fn new(origins_str: String) -> Option<Arc<Configured>> {

impl Cors {
    /// Creates a new Cors instance.
    pub fn new(origins_str: String) -> Self {
    pub fn new() -> Self {
        Self {
            origins: None,
            allowed_headers: HashSet::new(),
            allowed_methods: HashSet::new(),
            max_age: None,
            origins_str,
        }
    }

@@ -121,7 +119,7 @@ impl Cors {

impl Default for Cors {
    fn default() -> Self {
        Self::new("*".to_owned())
        Self::new()
    }
}