Skip to content

Commit 6b70b3e

Browse files
committed
hashset instead
1 parent fe0f2f8 commit 6b70b3e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::{
2+
collections::HashSet,
23
fs,
34
io::{ErrorKind, Read, stderr},
45
mem,
@@ -219,13 +220,9 @@ async fn main() -> anyhow::Result<()> {
219220
ip_addr: bind.map(|ip| ip.to_string()),
220221
port: gateway_port,
221222
domains: Some({
222-
let mut domains = vec!["localhost".to_string()];
223-
for d in domain {
224-
if !domains.contains(&d) {
225-
domains.push(d);
226-
}
227-
}
228-
domains
223+
let mut domains: HashSet<String> = domain.into_iter().collect();
224+
domains.insert("localhost".to_string());
225+
domains.into_iter().collect()
229226
}),
230227
https_config: None,
231228
});

0 commit comments

Comments
 (0)