Skip to content

Commit 906106f

Browse files
committed
refactor: field origins_str is never read on cors module
1 parent 78a924a commit 906106f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/cors.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ pub struct Cors {
1111
allowed_headers: HashSet<HeaderName>,
1212
max_age: Option<u64>,
1313
allowed_methods: HashSet<http::Method>,
14-
origins_str: String,
1514
origins: Option<HashSet<HeaderValue>>,
1615
}
1716

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

4241
impl Cors {
4342
/// Creates a new Cors instance.
44-
pub fn new(origins_str: String) -> Self {
43+
pub fn new() -> Self {
4544
Self {
4645
origins: None,
4746
allowed_headers: HashSet::new(),
4847
allowed_methods: HashSet::new(),
4948
max_age: None,
50-
origins_str,
5149
}
5250
}
5351

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

122120
impl Default for Cors {
123121
fn default() -> Self {
124-
Self::new("*".to_owned())
122+
Self::new()
125123
}
126124
}
127125

0 commit comments

Comments
 (0)