diff options
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/test.rs | 27 | ||||
-rw-r--r-- | cli/tools/vendor/analyze.rs | 2 | ||||
-rw-r--r-- | cli/tools/vendor/build.rs | 21 |
3 files changed, 32 insertions, 18 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs index ab6ded1b0..4bebe6fee 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -53,6 +53,7 @@ use serde::Deserialize; use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::HashSet; +use std::fmt::Write as _; use std::io::Read; use std::io::Write; use std::num::NonZeroUsize; @@ -618,27 +619,33 @@ impl TestReporter for PrettyTestReporter { let mut summary_result = String::new(); - summary_result.push_str(&format!( + write!( + summary_result, "{} passed{} | {} failed{}", summary.passed, get_steps_text(summary.passed_steps), summary.failed, get_steps_text(summary.failed_steps + summary.pending_steps), - )); + ) + .unwrap(); let ignored_steps = get_steps_text(summary.ignored_steps); if summary.ignored > 0 || !ignored_steps.is_empty() { - summary_result - .push_str(&format!(" | {} ignored{}", summary.ignored, ignored_steps)) - }; + write!( + summary_result, + " | {} ignored{}", + summary.ignored, ignored_steps + ) + .unwrap() + } if summary.measured > 0 { - summary_result.push_str(&format!(" | {} measured", summary.measured,)) - }; + write!(summary_result, " | {} measured", summary.measured,).unwrap(); + } if summary.filtered_out > 0 { - summary_result - .push_str(&format!(" | {} filtered out", summary.filtered_out,)) + write!(summary_result, " | {} filtered out", summary.filtered_out) + .unwrap() }; println!( @@ -891,7 +898,7 @@ fn extract_files_from_regex_blocks( let mut file_source = String::new(); for line in lines_regex.captures_iter(text) { let text = line.get(1).unwrap(); - file_source.push_str(&format!("{}\n", text.as_str())); + writeln!(file_source, "{}", text.as_str()).unwrap(); } let file_specifier = deno_core::resolve_url_or_path(&format!( diff --git a/cli/tools/vendor/analyze.rs b/cli/tools/vendor/analyze.rs index 6a1f53aae..0aa7010c7 100644 --- a/cli/tools/vendor/analyze.rs +++ b/cli/tools/vendor/analyze.rs @@ -25,7 +25,7 @@ struct DefaultExportFinder { has_default_export: bool, } -impl<'a> Visit for DefaultExportFinder { +impl Visit for DefaultExportFinder { noop_visit_type!(); fn visit_export_default_decl(&mut self, _: &ExportDefaultDecl) { diff --git a/cli/tools/vendor/build.rs b/cli/tools/vendor/build.rs index ecb7db717..341ef8684 100644 --- a/cli/tools/vendor/build.rs +++ b/cli/tools/vendor/build.rs @@ -1,5 +1,6 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use std::fmt::Write as _; use std::path::Path; use std::path::PathBuf; @@ -164,10 +165,14 @@ fn build_proxy_module_source( module: &Module, proxied_module: &ProxiedModule, ) -> String { - let mut text = format!( - "// @deno-types=\"{}\"\n", + let mut text = String::new(); + writeln!( + text, + "// @deno-types=\"{}\"", proxied_module.declaration_specifier - ); + ) + .unwrap(); + let relative_specifier = format!( "./{}", proxied_module @@ -179,15 +184,17 @@ fn build_proxy_module_source( // for simplicity, always include the `export *` statement as it won't error // even when the module does not contain a named export - text.push_str(&format!("export * from \"{}\";\n", relative_specifier)); + writeln!(text, "export * from \"{}\";", relative_specifier).unwrap(); // add a default export if one exists in the module if let Some(parsed_source) = module.maybe_parsed_source.as_ref() { if has_default_export(parsed_source) { - text.push_str(&format!( - "export {{ default }} from \"{}\";\n", + writeln!( + text, + "export {{ default }} from \"{}\";", relative_specifier - )); + ) + .unwrap(); } } |