summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/bench/http.rs2
-rw-r--r--cli/diagnostics.rs8
-rw-r--r--cli/diff.rs12
-rw-r--r--cli/info.rs2
-rw-r--r--cli/inspector.rs2
-rw-r--r--cli/lint.rs4
-rw-r--r--cli/main.rs2
-rw-r--r--cli/media_type.rs22
-rw-r--r--cli/permissions.rs2
-rw-r--r--cli/repl.rs26
-rw-r--r--cli/tests/integration_tests.rs2
11 files changed, 42 insertions, 42 deletions
diff --git a/cli/bench/http.rs b/cli/bench/http.rs
index e8cfd2b04..0d2650721 100644
--- a/cli/bench/http.rs
+++ b/cli/bench/http.rs
@@ -299,5 +299,5 @@ fn node_tcp() -> Result<HttpBenchmarkResult> {
fn hyper_http(exe: &str) -> Result<HttpBenchmarkResult> {
let port = get_port();
println!("http_benchmark testing RUST hyper");
- run(&[exe, &format!("{}", port)], port, None, None)
+ run(&[exe, &port.to_string()], port, None, None)
}
diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs
index ba21e5aa9..af2a63ad9 100644
--- a/cli/diagnostics.rs
+++ b/cli/diagnostics.rs
@@ -546,7 +546,7 @@ mod tests {
}
]);
let diagnostics: Diagnostics = serde_json::from_value(value).unwrap();
- let actual = format!("{}", diagnostics);
+ let actual = diagnostics.to_string();
assert_eq!(
strip_ansi_codes(&actual),
"TS5023 [ERROR]: Unknown compiler option \'invalid\'."
@@ -573,7 +573,7 @@ mod tests {
}
]);
let diagnostics: Diagnostics = serde_json::from_value(value).unwrap();
- let actual = format!("{}", diagnostics);
+ let actual = diagnostics.to_string();
assert_eq!(strip_ansi_codes(&actual), "TS2584 [ERROR]: Cannot find name \'console\'. Do you need to change your target library? Try changing the `lib` compiler option to include \'dom\'.\nconsole.log(\"a\");\n~~~~~~~\n at test.ts:1:1");
}
@@ -614,7 +614,7 @@ mod tests {
}
]);
let diagnostics: Diagnostics = serde_json::from_value(value).unwrap();
- let actual = format!("{}", diagnostics);
+ let actual = diagnostics.to_string();
assert_eq!(strip_ansi_codes(&actual), "TS2552 [ERROR]: Cannot find name \'foo_Bar\'. Did you mean \'foo_bar\'?\nfoo_Bar();\n~~~~~~~\n at test.ts:8:1\n\n \'foo_bar\' is declared here.\n function foo_bar() {\n ~~~~~~~\n at test.ts:4:10");
}
@@ -655,7 +655,7 @@ mod tests {
}
];
let diagnostics: Diagnostic = serde_json::from_value(value).unwrap();
- let actual = format!("{}", diagnostics);
+ let actual = diagnostics.to_string();
assert_eq!(strip_ansi_codes(&actual), "TS2551 [ERROR]: Property \'ppid\' does not exist on type \'typeof Deno\'. \'Deno.ppid\' is an unstable API. Did you forget to run with the \'--unstable\' flag, or did you mean \'pid\'?\nconsole.log(Deno.ppid);\n ~~~~\n at file:///cli/tests/unstable_ts2551.ts:1:18\n\n \'pid\' is declared here.\n export const pid: number;\n ~~~\n at asset:///lib.deno.ns.d.ts:90:16");
}
}
diff --git a/cli/diff.rs b/cli/diff.rs
index 7510ebfa9..c8a86736d 100644
--- a/cli/diff.rs
+++ b/cli/diff.rs
@@ -6,27 +6,27 @@ use std::fmt;
use std::fmt::Write;
fn fmt_add() -> String {
- format!("{}", colors::green_bold("+"))
+ colors::green_bold("+").to_string()
}
fn fmt_add_text(x: &str) -> String {
- format!("{}", colors::green(x))
+ colors::green(x).to_string()
}
fn fmt_add_text_highlight(x: &str) -> String {
- format!("{}", colors::black_on_green(x))
+ colors::black_on_green(x).to_string()
}
fn fmt_rem() -> String {
- format!("{}", colors::red_bold("-"))
+ colors::red_bold("-").to_string()
}
fn fmt_rem_text(x: &str) -> String {
- format!("{}", colors::red(x))
+ colors::red(x).to_string()
}
fn fmt_rem_text_highlight(x: &str) -> String {
- format!("{}", colors::white_on_red(x))
+ colors::white_on_red(x).to_string()
}
fn write_line_diff(
diff --git a/cli/info.rs b/cli/info.rs
index 9ca294287..d2ea4e7e6 100644
--- a/cli/info.rs
+++ b/cli/info.rs
@@ -272,7 +272,7 @@ mod test {
#[test]
fn test_module_graph_info_display() {
let fixture = get_fixture();
- let actual = format!("{}", fixture);
+ let actual = fixture.to_string();
assert!(actual.contains(" /a/b/c.ts"));
assert!(actual.contains(" 99 unique"));
assert!(actual.contains("(12.06KB)"));
diff --git a/cli/inspector.rs b/cli/inspector.rs
index 1a916c7c7..dd1122020 100644
--- a/cli/inspector.rs
+++ b/cli/inspector.rs
@@ -934,7 +934,7 @@ impl InspectorSession {
let response = response_rx.await.unwrap();
if let Some(error) = response.get("error") {
- return Err(generic_error(format!("{}", error)));
+ return Err(generic_error(error.to_string()));
}
let result = response.get("result").unwrap().clone();
diff --git a/cli/lint.rs b/cli/lint.rs
index e95af58f2..ff63b693c 100644
--- a/cli/lint.rs
+++ b/cli/lint.rs
@@ -276,9 +276,9 @@ pub fn format_diagnostic(
colors::red(&"^".repeat(line_len - range.start.col))
));
} else if range.end.line == i {
- lines.push(format!("{}", colors::red(&"^".repeat(range.end.col))));
+ lines.push(colors::red(&"^".repeat(range.end.col)).to_string());
} else if line_len != 0 {
- lines.push(format!("{}", colors::red(&"^".repeat(line_len))));
+ lines.push(colors::red(&"^".repeat(line_len)).to_string());
}
}
}
diff --git a/cli/main.rs b/cli/main.rs
index 9404a47b2..f35a4c587 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -187,7 +187,7 @@ async fn info_command(
if json {
write_json_to_stdout(&json!(info))?;
} else {
- write_to_stdout_ignore_sigpipe(format!("{}", info).as_bytes())?;
+ write_to_stdout_ignore_sigpipe(info.to_string().as_bytes())?;
}
Ok(())
} else {
diff --git a/cli/media_type.rs b/cli/media_type.rs
index fe5d16a5b..7be494a3a 100644
--- a/cli/media_type.rs
+++ b/cli/media_type.rs
@@ -194,7 +194,7 @@ pub fn serialize_media_type<S>(mt: &MediaType, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
- s.serialize_str(&format!("{}", mt))
+ s.serialize_str(&mt.to_string())
}
#[cfg(test)]
@@ -269,15 +269,15 @@ mod tests {
#[test]
fn test_display() {
- assert_eq!(format!("{}", MediaType::JavaScript), "JavaScript");
- assert_eq!(format!("{}", MediaType::JSX), "JSX");
- assert_eq!(format!("{}", MediaType::TypeScript), "TypeScript");
- assert_eq!(format!("{}", MediaType::Dts), "Dts");
- assert_eq!(format!("{}", MediaType::TSX), "TSX");
- assert_eq!(format!("{}", MediaType::Json), "Json");
- assert_eq!(format!("{}", MediaType::Wasm), "Wasm");
- assert_eq!(format!("{}", MediaType::TsBuildInfo), "TsBuildInfo");
- assert_eq!(format!("{}", MediaType::SourceMap), "SourceMap");
- assert_eq!(format!("{}", MediaType::Unknown), "Unknown");
+ assert_eq!(MediaType::JavaScript.to_string(), "JavaScript");
+ assert_eq!(MediaType::JSX.to_string(), "JSX");
+ assert_eq!(MediaType::TypeScript.to_string(), "TypeScript");
+ assert_eq!(MediaType::Dts.to_string(), "Dts");
+ assert_eq!(MediaType::TSX.to_string(), "TSX");
+ assert_eq!(MediaType::Json.to_string(), "Json");
+ assert_eq!(MediaType::Wasm.to_string(), "Wasm");
+ assert_eq!(MediaType::TsBuildInfo.to_string(), "TsBuildInfo");
+ assert_eq!(MediaType::SourceMap.to_string(), "SourceMap");
+ assert_eq!(MediaType::Unknown.to_string(), "Unknown");
}
}
diff --git a/cli/permissions.rs b/cli/permissions.rs
index e968b22ff..204176ad3 100644
--- a/cli/permissions.rs
+++ b/cli/permissions.rs
@@ -232,7 +232,7 @@ impl Permissions {
));
}
Ok(self.query_net(
- &format!("{}", parsed.host().unwrap()),
+ &parsed.host().unwrap().to_string(),
parsed.port_or_known_default(),
))
}
diff --git a/cli/repl.rs b/cli/repl.rs
index b5f89ec51..be85dc813 100644
--- a/cli/repl.rs
+++ b/cli/repl.rs
@@ -245,31 +245,31 @@ impl Highlighter for LineHighlighter {
.regex
.replace_all(&line.to_string(), |caps: &Captures<'_>| {
if let Some(cap) = caps.name("comment") {
- format!("{}", colors::gray(cap.as_str()))
+ colors::gray(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("string") {
- format!("{}", colors::green(cap.as_str()))
+ colors::green(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("regexp") {
- format!("{}", colors::red(cap.as_str()))
+ colors::red(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("number") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("boolean") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("null") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("undefined") {
- format!("{}", colors::gray(cap.as_str()))
+ colors::gray(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("keyword") {
- format!("{}", colors::cyan(cap.as_str()))
+ colors::cyan(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("infinity") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("classes") {
- format!("{}", colors::green_bold(cap.as_str()))
+ colors::green_bold(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("hexnumber") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("octalnumber") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else if let Some(cap) = caps.name("binarynumber") {
- format!("{}", colors::yellow(cap.as_str()))
+ colors::yellow(cap.as_str()).to_string()
} else {
caps[0].to_string()
}
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 16be10900..3618c2e77 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -3814,7 +3814,7 @@ async fn inspector_does_not_hang() {
for i in 0..128u32 {
let request_id = i + 10;
// Expect the number {i} on stdout.
- let s = format!("{}", i);
+ let s = i.to_string();
assert_eq!(stdout_lines.next().unwrap(), s);
// Expect hitting the `debugger` statement.
let s = r#"{"method":"Debugger.paused","#;