1 Commits
async ... 1.0.3

Author SHA1 Message Date
e071381e03 Format Rust code using rustfmt 2023-07-25 16:20:32 +00:00
3 changed files with 7 additions and 11 deletions

3
Cargo.lock generated
View File

@ -1043,7 +1043,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "rexec"
version = "1.0.3"
version = "1.0.2"
dependencies = [
"brace-expand",
"clap 4.3.4",
@ -1056,7 +1056,6 @@ dependencies = [
"log",
"massh",
"regex",
"tokio",
"whoami",
]

View File

@ -12,7 +12,6 @@ authors = ["AB <gh@hexor.ru>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1", features = ["full"] }
dns-lookup = "2.0.2"
log = "0.4.0"
env_logger = "0.10.0"

View File

@ -94,11 +94,11 @@ fn expand_string(s: &str) -> Vec<Host> {
let start = r.find('[').unwrap();
let end = r.find(']').unwrap();
let colon = r.find(':').unwrap();
let low = r[start+1..colon].parse::<i32>().unwrap();
let high = r[colon+1..end].parse::<i32>().unwrap();
let low = r[start + 1..colon].parse::<i32>().unwrap();
let high = r[colon + 1..end].parse::<i32>().unwrap();
result.retain(|s| s != &r);
for val in expand_range(low, high) {
let new_str = format!("{}{}{}", &r[..start], val, &r[end+1..]);
let new_str = format!("{}{}{}", &r[..start], val, &r[end + 1..]);
result.push(new_str);
}
}
@ -107,10 +107,10 @@ fn expand_string(s: &str) -> Vec<Host> {
let r = r.clone();
let start = r.find('{').unwrap();
let end = r.find('}').unwrap();
let list = &r[start+1..end];
let list = &r[start + 1..end];
result.retain(|s| s != &r);
for val in expand_list(list) {
let new_str = format!("{}{}{}", &r[..start], val, &r[end+1..]);
let new_str = format!("{}{}{}", &r[..start], val, &r[end + 1..]);
result.push(new_str);
}
}
@ -124,8 +124,7 @@ fn expand_string(s: &str) -> Vec<Host> {
hosts
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
fn main() {
env_logger::Builder::from_env(Env::default().default_filter_or("info"))
.format_timestamp(None)
.format_target(false)
@ -242,5 +241,4 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
} else {
warn!("Stopped");
}
Ok(())
}