diff options
Diffstat (limited to 'cli/args')
-rw-r--r-- | cli/args/config_file.rs | 2 | ||||
-rw-r--r-- | cli/args/flags.rs | 6 | ||||
-rw-r--r-- | cli/args/flags_allow_net.rs | 8 | ||||
-rw-r--r-- | cli/args/import_map.rs | 2 | ||||
-rw-r--r-- | cli/args/mod.rs | 12 |
5 files changed, 14 insertions, 16 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs index 82ae7e5d7..ad204f449 100644 --- a/cli/args/config_file.rs +++ b/cli/args/config_file.rs @@ -163,7 +163,7 @@ pub const IGNORED_COMPILER_OPTIONS: &[&str] = &[ /// A function that works like JavaScript's `Object.assign()`. pub fn json_merge(a: &mut Value, b: &Value) { match (a, b) { - (&mut Value::Object(ref mut a), &Value::Object(ref b)) => { + (&mut Value::Object(ref mut a), Value::Object(b)) => { for (k, v) in b { json_merge(a.entry(k.clone()).or_insert(Value::Null), v); } diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 00df45274..257a99eb5 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -1904,7 +1904,7 @@ fn permission_args(app: Command) -> Command { .validator(|keys| { for key in keys.split(',') { if key.is_empty() || key.contains(&['=', '\0'] as &[char]) { - return Err(format!("invalid key \"{}\"", key)); + return Err(format!("invalid key \"{key}\"")); } } Ok(()) @@ -3164,7 +3164,7 @@ fn seed_arg_parse(flags: &mut Flags, matches: &ArgMatches) { let seed = seed_string.parse::<u64>().unwrap(); flags.seed = Some(seed); - flags.v8_flags.push(format!("--random-seed={}", seed)); + flags.v8_flags.push(format!("--random-seed={seed}")); } } @@ -3293,7 +3293,7 @@ pub fn resolve_urls(urls: Vec<String>) -> Vec<String> { } out.push(full_url); } else { - panic!("Bad Url: {}", urlstr); + panic!("Bad Url: {urlstr}"); } } out diff --git a/cli/args/flags_allow_net.rs b/cli/args/flags_allow_net.rs index bf189132a..88d9d3c02 100644 --- a/cli/args/flags_allow_net.rs +++ b/cli/args/flags_allow_net.rs @@ -27,13 +27,13 @@ impl FromStr for BarePort { } pub fn validator(host_and_port: &str) -> Result<(), String> { - if Url::parse(&format!("deno://{}", host_and_port)).is_ok() + if Url::parse(&format!("deno://{host_and_port}")).is_ok() || host_and_port.parse::<IpAddr>().is_ok() || host_and_port.parse::<BarePort>().is_ok() { Ok(()) } else { - Err(format!("Bad host:port pair: {}", host_and_port)) + Err(format!("Bad host:port pair: {host_and_port}")) } } @@ -43,7 +43,7 @@ pub fn validator(host_and_port: &str) -> Result<(), String> { pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> { let mut out: Vec<String> = vec![]; for host_and_port in paths.iter() { - if Url::parse(&format!("deno://{}", host_and_port)).is_ok() + if Url::parse(&format!("deno://{host_and_port}")).is_ok() || host_and_port.parse::<IpAddr>().is_ok() { out.push(host_and_port.to_owned()) @@ -55,7 +55,7 @@ pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> { } else { return Err(clap::Error::raw( clap::ErrorKind::InvalidValue, - format!("Bad host:port pair: {}", host_and_port), + format!("Bad host:port pair: {host_and_port}"), )); } } diff --git a/cli/args/import_map.rs b/cli/args/import_map.rs index bac31c080..9d1b2bbda 100644 --- a/cli/args/import_map.rs +++ b/cli/args/import_map.rs @@ -56,7 +56,7 @@ fn print_import_map_diagnostics(diagnostics: &[ImportMapDiagnostic]) { "Import map diagnostics:\n{}", diagnostics .iter() - .map(|d| format!(" - {}", d)) + .map(|d| format!(" - {d}")) .collect::<Vec<_>>() .join("\n") ); diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 5cb29cab2..d75f25d52 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -90,7 +90,7 @@ impl CacheSetting { if list.iter().any(|i| i == "npm:") { return false; } - let specifier = format!("npm:{}", package_name); + let specifier = format!("npm:{package_name}"); if list.contains(&specifier) { return false; } @@ -491,7 +491,7 @@ impl CliOptions { format!("for: {}", insecure_allowlist.join(", ")) }; let msg = - format!("DANGER: TLS certificate validation is disabled {}", domains); + format!("DANGER: TLS certificate validation is disabled {domains}"); // use eprintln instead of log::warn so this always gets shown eprintln!("{}", colors::yellow(msg)); } @@ -579,8 +579,7 @@ impl CliOptions { ) .await .context(format!( - "Unable to load '{}' import map", - import_map_specifier + "Unable to load '{import_map_specifier}' import map" )) .map(Some) } @@ -929,7 +928,7 @@ fn resolve_import_map_specifier( } } let specifier = deno_core::resolve_url_or_path(import_map_path) - .context(format!("Bad URL (\"{}\") for import map.", import_map_path))?; + .context(format!("Bad URL (\"{import_map_path}\") for import map."))?; return Ok(Some(specifier)); } else if let Some(config_file) = &maybe_config_file { // if the config file is an import map we prefer to use it, over `importMap` @@ -970,8 +969,7 @@ fn resolve_import_map_specifier( } else { deno_core::resolve_import(&import_map_path, config_file.specifier.as_str()) .context(format!( - "Bad URL (\"{}\") for import map.", - import_map_path + "Bad URL (\"{import_map_path}\") for import map." ))? }; return Ok(Some(specifier)); |