diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/args/config_file.rs | 2 | ||||
-rw-r--r-- | cli/args/mod.rs | 4 | ||||
-rw-r--r-- | cli/bench/main.rs | 2 | ||||
-rw-r--r-- | cli/cache/disk_cache.rs | 2 | ||||
-rw-r--r-- | cli/lsp/completions.rs | 6 | ||||
-rw-r--r-- | cli/lsp/documents.rs | 2 | ||||
-rw-r--r-- | cli/lsp/registries.rs | 2 | ||||
-rw-r--r-- | cli/lsp/tsc.rs | 2 | ||||
-rw-r--r-- | cli/napi/js_native_api.rs | 6 | ||||
-rw-r--r-- | cli/node/mod.rs | 4 | ||||
-rw-r--r-- | cli/npm/resolvers/local.rs | 8 | ||||
-rw-r--r-- | cli/npm/resolvers/mod.rs | 4 | ||||
-rw-r--r-- | cli/tests/coverage_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/fmt_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/run_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/watcher_tests.rs | 24 | ||||
-rw-r--r-- | cli/tools/coverage/merge.rs | 4 | ||||
-rw-r--r-- | cli/tools/info.rs | 10 | ||||
-rw-r--r-- | cli/tools/installer.rs | 6 | ||||
-rw-r--r-- | cli/tools/vendor/mod.rs | 2 | ||||
-rw-r--r-- | cli/tools/vendor/test.rs | 2 | ||||
-rw-r--r-- | cli/tsc/mod.rs | 2 | ||||
-rw-r--r-- | cli/util/fs.rs | 4 | ||||
-rw-r--r-- | cli/util/progress_bar/renderer.rs | 4 |
24 files changed, 56 insertions, 60 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs index 904efdff8..0fa8e4d61 100644 --- a/cli/args/config_file.rs +++ b/cli/args/config_file.rs @@ -593,7 +593,7 @@ impl ConfigFile { pub fn from_specifier(specifier: &ModuleSpecifier) -> Result<Self, AnyError> { let config_path = specifier_to_file_path(specifier)?; - let config_text = match std::fs::read_to_string(&config_path) { + let config_text = match std::fs::read_to_string(config_path) { Ok(text) => text, Err(err) => bail!( "Error reading config file {}: {}", diff --git a/cli/args/mod.rs b/cli/args/mod.rs index f936f9c25..09690412d 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -150,7 +150,7 @@ pub fn get_root_cert_store( } else { PathBuf::from(ca_file) }; - let certfile = std::fs::File::open(&ca_file)?; + let certfile = std::fs::File::open(ca_file)?; let mut reader = BufReader::new(certfile); match rustls_pemfile::certs(&mut reader) { @@ -720,7 +720,7 @@ mod test { let import_map_path = std::env::current_dir().unwrap().join("import-map.json"); let expected_specifier = - ModuleSpecifier::from_file_path(&import_map_path).unwrap(); + ModuleSpecifier::from_file_path(import_map_path).unwrap(); assert!(actual.is_ok()); let actual = actual.unwrap(); assert_eq!(actual, Some(expected_specifier)); diff --git a/cli/bench/main.rs b/cli/bench/main.rs index c756c2c2e..02df982d8 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -433,7 +433,7 @@ async fn main() -> Result<()> { let target_dir = test_util::target_dir(); let deno_exe = test_util::deno_exe_path(); - env::set_current_dir(&test_util::root_path())?; + env::set_current_dir(test_util::root_path())?; let mut new_data = BenchResult { created_at: chrono::Utc::now() diff --git a/cli/cache/disk_cache.rs b/cli/cache/disk_cache.rs index 60e353d85..894b96d2a 100644 --- a/cli/cache/disk_cache.rs +++ b/cli/cache/disk_cache.rs @@ -136,7 +136,7 @@ impl DiskCache { pub fn get(&self, filename: &Path) -> std::io::Result<Vec<u8>> { let path = self.location.join(filename); - fs::read(&path) + fs::read(path) } pub fn set(&self, filename: &Path, data: &[u8]) -> std::io::Result<()> { diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs index 5e0fad0f4..7a93c8baf 100644 --- a/cli/lsp/completions.rs +++ b/cli/lsp/completions.rs @@ -587,11 +587,11 @@ mod tests { let file_c = dir_a.join("c.ts"); std::fs::write(&file_c, b"").expect("could not create"); let file_d = dir_b.join("d.ts"); - std::fs::write(&file_d, b"").expect("could not create"); + std::fs::write(file_d, b"").expect("could not create"); let file_e = dir_a.join("e.txt"); - std::fs::write(&file_e, b"").expect("could not create"); + std::fs::write(file_e, b"").expect("could not create"); let file_f = dir_a.join("f.mjs"); - std::fs::write(&file_f, b"").expect("could not create"); + std::fs::write(file_f, b"").expect("could not create"); let specifier = ModuleSpecifier::from_file_path(file_c).expect("could not create"); let actual = get_local_completions( diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 82e2618b3..936d225ec 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -1266,7 +1266,7 @@ fn lsp_deno_graph_analyze( use deno_graph::ModuleParser; let analyzer = deno_graph::CapturingModuleAnalyzer::new( - Some(Box::new(LspModuleParser::default())), + Some(Box::<LspModuleParser>::default()), None, ); let parsed_source_result = analyzer.parse_module( diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs index 1488077dd..aeaa4c012 100644 --- a/cli/lsp/registries.rs +++ b/cli/lsp/registries.rs @@ -955,7 +955,7 @@ impl ModuleRegistry { None } else { Some(lsp::CompletionList { - items: completions.into_iter().map(|(_, i)| i).collect(), + items: completions.into_values().collect(), is_incomplete, }) }; diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs index 1152c080d..5d5b8213b 100644 --- a/cli/lsp/tsc.rs +++ b/cli/lsp/tsc.rs @@ -1969,7 +1969,7 @@ impl CompletionEntryDetails { let detail = if original_item.detail.is_some() { original_item.detail.clone() } else if !self.display_parts.is_empty() { - Some(replace_links(&display_parts_to_string( + Some(replace_links(display_parts_to_string( &self.display_parts, language_server, ))) diff --git a/cli/napi/js_native_api.rs b/cli/napi/js_native_api.rs index dedea8f79..256584a13 100644 --- a/cli/napi/js_native_api.rs +++ b/cli/napi/js_native_api.rs @@ -549,7 +549,7 @@ fn napi_create_string_latin1( .unwrap() .as_bytes() } else { - std::slice::from_raw_parts(string, length as usize) + std::slice::from_raw_parts(string, length) }; match v8::String::new_from_one_byte( &mut env.scope(), @@ -626,7 +626,7 @@ fn napi_create_string_utf8( .to_str() .unwrap() } else { - let string = std::slice::from_raw_parts(string, length as usize); + let string = std::slice::from_raw_parts(string, length); std::str::from_utf8(string).unwrap() }; let v8str = v8::String::new(&mut env.scope(), string).unwrap(); @@ -1070,7 +1070,7 @@ fn napi_call_function( .map_err(|_| Error::FunctionExpected)?; let argv: &[v8::Local<v8::Value>] = - transmute(std::slice::from_raw_parts(argv, argc as usize)); + transmute(std::slice::from_raw_parts(argv, argc)); let ret = func.call(&mut env.scope(), recv, argv); if !result.is_null() { *result = transmute::<Option<v8::Local<v8::Value>>, napi_value>(ret); diff --git a/cli/node/mod.rs b/cli/node/mod.rs index 190f386a7..19bc4ed14 100644 --- a/cli/node/mod.rs +++ b/cli/node/mod.rs @@ -759,7 +759,7 @@ fn finalize_resolution( p_str.to_string() }; - let (is_dir, is_file) = if let Ok(stats) = std::fs::metadata(&p) { + let (is_dir, is_file) = if let Ok(stats) = std::fs::metadata(p) { (stats.is_dir(), stats.is_file()) } else { (false, false) @@ -958,7 +958,7 @@ pub fn translate_cjs_to_esm( npm_resolver, )?; let reexport_specifier = - ModuleSpecifier::from_file_path(&resolved_reexport).unwrap(); + ModuleSpecifier::from_file_path(resolved_reexport).unwrap(); // Second, read the source code from disk let reexport_file = file_fetcher .get_source(&reexport_specifier) diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs index 69f275c70..5343dc2b4 100644 --- a/cli/npm/resolvers/local.rs +++ b/cli/npm/resolvers/local.rs @@ -342,7 +342,7 @@ async fn sync_resolution_with_fs( for package in &package_partitions.copy_packages { let package_cache_folder_id = package.get_package_cache_folder_id(); let destination_path = deno_local_registry_dir - .join(&get_package_folder_id_folder_name(&package_cache_folder_id)); + .join(get_package_folder_id_folder_name(&package_cache_folder_id)); let initialized_file = destination_path.join(".initialized"); if !initialized_file.exists() { let sub_node_modules = destination_path.join("node_modules"); @@ -352,7 +352,7 @@ async fn sync_resolution_with_fs( })?; let source_path = join_package_name( &deno_local_registry_dir - .join(&get_package_folder_id_folder_name( + .join(get_package_folder_id_folder_name( &package_cache_folder_id.with_no_count(), )) .join("node_modules"), @@ -372,7 +372,7 @@ async fn sync_resolution_with_fs( // node_modules/.deno/<dep_id>/node_modules/<dep_package_name> for package in &all_packages { let sub_node_modules = deno_local_registry_dir - .join(&get_package_folder_id_folder_name( + .join(get_package_folder_id_folder_name( &package.get_package_cache_folder_id(), )) .join("node_modules"); @@ -419,7 +419,7 @@ async fn sync_resolution_with_fs( let package = snapshot.package_from_id(&package_id).unwrap(); let local_registry_package_path = join_package_name( &deno_local_registry_dir - .join(&get_package_folder_id_folder_name( + .join(get_package_folder_id_folder_name( &package.get_package_cache_folder_id(), )) .join("node_modules"), diff --git a/cli/npm/resolvers/mod.rs b/cli/npm/resolvers/mod.rs index a9c459d12..0f1ed5d85 100644 --- a/cli/npm/resolvers/mod.rs +++ b/cli/npm/resolvers/mod.rs @@ -355,7 +355,7 @@ impl RequireNpmResolver for NpmPackageResolver { fn in_npm_package(&self, path: &Path) -> bool { let specifier = - match ModuleSpecifier::from_file_path(&path.to_path_buf().clean()) { + match ModuleSpecifier::from_file_path(path.to_path_buf().clean()) { Ok(p) => p, Err(_) => return false, }; @@ -370,7 +370,7 @@ impl RequireNpmResolver for NpmPackageResolver { } fn path_to_specifier(path: &Path) -> Result<ModuleSpecifier, AnyError> { - match ModuleSpecifier::from_file_path(&path.to_path_buf().clean()) { + match ModuleSpecifier::from_file_path(path.to_path_buf().clean()) { Ok(specifier) => Ok(specifier), Err(()) => bail!("Could not convert '{}' to url.", path.display()), } diff --git a/cli/tests/coverage_tests.rs b/cli/tests/coverage_tests.rs index 6515fd6ec..357d54ee6 100644 --- a/cli/tests/coverage_tests.rs +++ b/cli/tests/coverage_tests.rs @@ -51,7 +51,7 @@ mod coverage { // Write the inital mod.ts file std::fs::copy(mod_before_path, &mod_temp_path).unwrap(); // And the test file - std::fs::copy(mod_test_path, &mod_test_temp_path).unwrap(); + std::fs::copy(mod_test_path, mod_test_temp_path).unwrap(); // Generate coverage let status = util::deno_cmd_with_deno_dir(&deno_dir) diff --git a/cli/tests/fmt_tests.rs b/cli/tests/fmt_tests.rs index 6ace4ce5b..807306b2c 100644 --- a/cli/tests/fmt_tests.rs +++ b/cli/tests/fmt_tests.rs @@ -17,21 +17,21 @@ mod fmt { testdata_fmt_dir.join("badly_formatted.mjs"); let badly_formatted_js = t.path().join("badly_formatted.js"); let badly_formatted_js_str = badly_formatted_js.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap(); + std::fs::copy(badly_formatted_original_js, &badly_formatted_js).unwrap(); let fixed_md = testdata_fmt_dir.join("badly_formatted_fixed.md"); let badly_formatted_original_md = testdata_fmt_dir.join("badly_formatted.md"); let badly_formatted_md = t.path().join("badly_formatted.md"); let badly_formatted_md_str = badly_formatted_md.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap(); + std::fs::copy(badly_formatted_original_md, &badly_formatted_md).unwrap(); let fixed_json = testdata_fmt_dir.join("badly_formatted_fixed.json"); let badly_formatted_original_json = testdata_fmt_dir.join("badly_formatted.json"); let badly_formatted_json = t.path().join("badly_formatted.json"); let badly_formatted_json_str = badly_formatted_json.to_str().unwrap(); - std::fs::copy(&badly_formatted_original_json, &badly_formatted_json) + std::fs::copy(badly_formatted_original_json, &badly_formatted_json) .unwrap(); // First, check formatting by ignoring the badly formatted file. let status = util::deno_cmd() diff --git a/cli/tests/run_tests.rs b/cli/tests/run_tests.rs index 6cae9d9e3..6196f641d 100644 --- a/cli/tests/run_tests.rs +++ b/cli/tests/run_tests.rs @@ -2505,7 +2505,7 @@ mod run { .unwrap(); assert!(status.success()); std::fs::write(&mod1_path, "export { foo } from \"./mod2.ts\";").unwrap(); - std::fs::write(&mod2_path, "(").unwrap(); + std::fs::write(mod2_path, "(").unwrap(); let status = deno_cmd .current_dir(util::testdata_path()) .arg("run") @@ -2528,7 +2528,7 @@ mod run { let mut deno_cmd = util::deno_cmd(); // With a fresh `DENO_DIR`, run a module with a dependency and a type error. std::fs::write(&mod1_path, "import './mod2.ts'; Deno.exit('0');").unwrap(); - std::fs::write(&mod2_path, "console.log('Hello, world!');").unwrap(); + std::fs::write(mod2_path, "console.log('Hello, world!');").unwrap(); let status = deno_cmd .current_dir(util::testdata_path()) .arg("run") @@ -2969,7 +2969,7 @@ mod run { assert!(output.status.success()); let prg = util::deno_exe_path(); - let output = Command::new(&prg) + let output = Command::new(prg) .env("DENO_DIR", deno_dir.path()) .env("HTTP_PROXY", "http://nil") .env("NO_COLOR", "1") diff --git a/cli/tests/watcher_tests.rs b/cli/tests/watcher_tests.rs index f9c8e1508..06af71eb4 100644 --- a/cli/tests/watcher_tests.rs +++ b/cli/tests/watcher_tests.rs @@ -105,7 +105,7 @@ mod watcher { util::testdata_path().join("lint/watch/badly_linted_fixed2.js.out"); let badly_linted = t.path().join("badly_linted.js"); - std::fs::copy(&badly_linted_original, &badly_linted).unwrap(); + std::fs::copy(badly_linted_original, &badly_linted).unwrap(); let mut child = util::deno_cmd() .current_dir(util::testdata_path()) @@ -125,7 +125,7 @@ mod watcher { assert_eq!(output, expected); // Change content of the file again to be badly-linted1 - std::fs::copy(&badly_linted_fixed1, &badly_linted).unwrap(); + std::fs::copy(badly_linted_fixed1, &badly_linted).unwrap(); std::thread::sleep(std::time::Duration::from_secs(1)); output = read_all_lints(&mut stderr_lines); @@ -133,7 +133,7 @@ mod watcher { assert_eq!(output, expected); // Change content of the file again to be badly-linted1 - std::fs::copy(&badly_linted_fixed2, &badly_linted).unwrap(); + std::fs::copy(badly_linted_fixed2, &badly_linted).unwrap(); output = read_all_lints(&mut stderr_lines); let expected = std::fs::read_to_string(badly_linted_fixed2_output).unwrap(); @@ -163,7 +163,7 @@ mod watcher { util::testdata_path().join("lint/watch/badly_linted_fixed2.js.out"); let badly_linted = t.path().join("badly_linted.js"); - std::fs::copy(&badly_linted_original, &badly_linted).unwrap(); + std::fs::copy(badly_linted_original, &badly_linted).unwrap(); let mut child = util::deno_cmd() .current_dir(t.path()) @@ -183,14 +183,14 @@ mod watcher { assert_eq!(output, expected); // Change content of the file again to be badly-linted1 - std::fs::copy(&badly_linted_fixed1, &badly_linted).unwrap(); + std::fs::copy(badly_linted_fixed1, &badly_linted).unwrap(); output = read_all_lints(&mut stderr_lines); let expected = std::fs::read_to_string(badly_linted_fixed1_output).unwrap(); assert_eq!(output, expected); // Change content of the file again to be badly-linted1 - std::fs::copy(&badly_linted_fixed2, &badly_linted).unwrap(); + std::fs::copy(badly_linted_fixed2, &badly_linted).unwrap(); std::thread::sleep(std::time::Duration::from_secs(1)); output = read_all_lints(&mut stderr_lines); @@ -216,8 +216,8 @@ mod watcher { let badly_linted_1 = t.path().join("badly_linted_1.js"); let badly_linted_2 = t.path().join("badly_linted_2.js"); - std::fs::copy(&badly_linted_fixed0, &badly_linted_1).unwrap(); - std::fs::copy(&badly_linted_fixed1, &badly_linted_2).unwrap(); + std::fs::copy(badly_linted_fixed0, badly_linted_1).unwrap(); + std::fs::copy(badly_linted_fixed1, &badly_linted_2).unwrap(); let mut child = util::deno_cmd() .current_dir(util::testdata_path()) @@ -236,7 +236,7 @@ mod watcher { "Checked 2 files" ); - std::fs::copy(&badly_linted_fixed2, &badly_linted_2).unwrap(); + std::fs::copy(badly_linted_fixed2, badly_linted_2).unwrap(); assert_contains!( read_line("Checked", &mut stderr_lines), @@ -356,7 +356,7 @@ mod watcher { let badly_formatted_1 = t.path().join("badly_formatted_1.js"); let badly_formatted_2 = t.path().join("badly_formatted_2.js"); std::fs::copy(&badly_formatted_original, &badly_formatted_1).unwrap(); - std::fs::copy(&badly_formatted_original, &badly_formatted_2).unwrap(); + std::fs::copy(&badly_formatted_original, badly_formatted_2).unwrap(); let mut child = util::deno_cmd() .current_dir(&fmt_testdata_path) @@ -868,7 +868,7 @@ mod watcher { ) .unwrap(); write( - &bar_test, + bar_test, "import bar from './bar.js'; Deno.test('bar', bar);", ) .unwrap(); @@ -1102,7 +1102,7 @@ mod watcher { .unwrap(); let file_to_watch2 = t.path().join("imported.js"); write( - &file_to_watch2, + file_to_watch2, r#" import "./imported2.js"; console.log("I'm dynamically imported and I cause restarts!"); diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs index 63b795f76..d995c6ab3 100644 --- a/cli/tools/coverage/merge.rs +++ b/cli/tools/coverage/merge.rs @@ -73,8 +73,8 @@ pub fn merge_scripts( } let functions: Vec<FunctionCoverage> = range_to_funcs - .into_iter() - .map(|(_, funcs)| merge_functions(funcs).unwrap()) + .into_values() + .map(|funcs| merge_functions(funcs).unwrap()) .collect(); Some(ScriptCoverage { diff --git a/cli/tools/info.rs b/cli/tools/info.rs index 6ab74360b..86a18c4e2 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -70,7 +70,7 @@ fn print_cache_info( if let Some(location) = &location { origin_dir = - origin_dir.join(&checksum::gen(&[location.to_string().as_bytes()])); + origin_dir.join(checksum::gen(&[location.to_string().as_bytes()])); } let local_storage_dir = origin_dir.join("local_storage"); @@ -526,11 +526,9 @@ impl<'a> GraphDisplayContext<'a> { Specifier(_) => specifier_str, }; let maybe_size = match &package_or_specifier { - Package(package) => self - .npm_info - .package_sizes - .get(&package.id) - .map(|s| *s as u64), + Package(package) => { + self.npm_info.package_sizes.get(&package.id).copied() + } Specifier(_) => module .maybe_source .as_ref() diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index db49ed7a0..07397131c 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -77,7 +77,7 @@ deno {} "$@" "#, args.join(" "), ); - let mut file = File::create(&shim_data.file_path.with_extension(""))?; + let mut file = File::create(shim_data.file_path.with_extension(""))?; file.write_all(template.as_bytes())?; Ok(()) } @@ -1127,11 +1127,11 @@ mod tests { // create extra files { let file_path = file_path.with_extension("tsconfig.json"); - File::create(&file_path).unwrap(); + File::create(file_path).unwrap(); } { let file_path = file_path.with_extension("lock.json"); - File::create(&file_path).unwrap(); + File::create(file_path).unwrap(); } uninstall("echo_test".to_string(), Some(temp_dir.path().to_path_buf())) diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index 02261e34c..21e3a4485 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -120,7 +120,7 @@ fn validate_options( format!("Failed to canonicalize: {}", output_dir.display()) })?; - if import_map_path.starts_with(&output_dir) { + if import_map_path.starts_with(output_dir) { // canonicalize to make the test for this pass on the CI let cwd = canonicalize_path(&std::env::current_dir()?)?; // We don't allow using the output directory to help generate the diff --git a/cli/tools/vendor/test.rs b/cli/tools/vendor/test.rs index c703357d8..9cf2bb603 100644 --- a/cli/tools/vendor/test.rs +++ b/cli/tools/vendor/test.rs @@ -192,7 +192,7 @@ impl VendorTestBuilder { } pub fn new_import_map(&self, base_path: &str) -> ImportMap { - let base = ModuleSpecifier::from_file_path(&make_path(base_path)).unwrap(); + let base = ModuleSpecifier::from_file_path(make_path(base_path)).unwrap(); ImportMap::new(base) } diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index 3751712f0..2b7b3d368 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -858,7 +858,7 @@ mod tests { .replace("://", "_") .replace('/', "-"); let source_path = self.fixtures.join(specifier_text); - let response = fs::read_to_string(&source_path) + let response = fs::read_to_string(source_path) .map(|c| { Some(deno_graph::source::LoadResponse::Module { specifier: specifier.clone(), diff --git a/cli/util/fs.rs b/cli/util/fs.rs index 40dfafdd8..cb8a4d369 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -160,7 +160,7 @@ pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> { cwd.join(path) }; - Ok(normalize_path(&resolved_path)) + Ok(normalize_path(resolved_path)) } /// Collects file paths that satisfy the given predicate, by recursively walking `files`. @@ -280,7 +280,7 @@ pub fn collect_specifiers( } else { root_path.join(path) }; - let p = normalize_path(&p); + let p = normalize_path(p); if p.is_dir() { let test_files = file_collector.collect_files(&[p])?; let mut test_files_as_urls = test_files diff --git a/cli/util/progress_bar/renderer.rs b/cli/util/progress_bar/renderer.rs index cb249ce36..75a4cafed 100644 --- a/cli/util/progress_bar/renderer.rs +++ b/cli/util/progress_bar/renderer.rs @@ -75,9 +75,7 @@ impl ProgressBarRenderer for BarProgressBarRenderer { )); } text.push_str(&elapsed_text); - let max_width = - std::cmp::max(10, std::cmp::min(75, data.terminal_width as i32 - 5)) - as usize; + let max_width = (data.terminal_width as i32 - 5).clamp(10, 75) as usize; let same_line_text_width = elapsed_text.len() + total_text_max_width + bytes_text_max_width + 3; // space, open and close brace let total_bars = if same_line_text_width > max_width { |