Skip to content

Commit 2e85a6e

Browse files
change from HashMap to Vec (#792)
1 parent 9b43d1c commit 2e85a6e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/input.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Provides a means to read, parse and hold configuration options for scans.
22
use clap::{Parser, ValueEnum};
33
use serde_derive::Deserialize;
4-
use std::collections::HashMap;
54
use std::fs;
65
use std::path::PathBuf;
76

@@ -218,11 +217,7 @@ impl Opts {
218217

219218
// Only use top ports when the user asks for them
220219
if self.top && config.ports.is_some() {
221-
let mut ports: Vec<u16> = Vec::with_capacity(config.ports.as_ref().unwrap().len());
222-
for entry in config.ports.as_ref().unwrap().keys() {
223-
ports.push(entry.parse().unwrap());
224-
}
225-
self.ports = Some(ports);
220+
self.ports = config.ports.clone();
226221
}
227222

228223
merge_optional!(range, resolver, ulimit, exclude_ports, exclude_addresses);
@@ -263,7 +258,7 @@ impl Default for Opts {
263258
#[derive(Debug, Deserialize)]
264259
pub struct Config {
265260
addresses: Option<Vec<String>>,
266-
ports: Option<HashMap<String, u16>>,
261+
ports: Option<Vec<u16>>,
267262
range: Option<PortRange>,
268263
greppable: Option<bool>,
269264
accessible: Option<bool>,

0 commit comments

Comments
 (0)