summaryrefslogtreecommitdiff
path: root/runtime/permissions/prompter.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-01-27 10:43:16 -0500
committerGitHub <noreply@github.com>2023-01-27 10:43:16 -0500
commitf5840bdcd360ec0bac2501f333e58e25742b1537 (patch)
tree7eb0818d2cafa0f6824e81b6ed2cfb609830971e /runtime/permissions/prompter.rs
parent1a1faff2f67613ed0b89e1a34e6c3fd02ca6fd83 (diff)
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/permissions/prompter.rs')
-rw-r--r--runtime/permissions/prompter.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/runtime/permissions/prompter.rs b/runtime/permissions/prompter.rs
index ae07e004c..e311bc978 100644
--- a/runtime/permissions/prompter.rs
+++ b/runtime/permissions/prompter.rs
@@ -182,13 +182,13 @@ impl PermissionPrompter for TtyPrompter {
// Clear n-lines in terminal and move cursor to the beginning of the line.
fn clear_n_lines(n: usize) {
- eprint!("\x1B[{}A\x1B[0J", n);
+ eprint!("\x1B[{n}A\x1B[0J");
}
// For security reasons we must consume everything in stdin so that previously
// buffered data cannot effect the prompt.
if let Err(err) = clear_stdin() {
- eprintln!("Error clearing stdin for permission prompt. {:#}", err);
+ eprintln!("Error clearing stdin for permission prompt. {err:#}");
return PromptResponse::Deny; // don't grant permission if this fails
}
@@ -199,17 +199,17 @@ impl PermissionPrompter for TtyPrompter {
// print to stderr so that if stdout is piped this is still displayed.
const OPTS: &str = "[y/n] (y = yes, allow; n = no, deny)";
- eprint!("{} ┌ ", PERMISSION_EMOJI);
+ eprint!("{PERMISSION_EMOJI} ┌ ");
eprint!("{}", colors::bold("Deno requests "));
eprint!("{}", colors::bold(message));
eprintln!("{}", colors::bold("."));
if let Some(api_name) = api_name {
- eprintln!(" ├ Requested by `{}` API", api_name);
+ eprintln!(" ├ Requested by `{api_name}` API");
}
- let msg = format!("Run again with --allow-{} to bypass this prompt.", name);
+ let msg = format!("Run again with --allow-{name} to bypass this prompt.");
eprintln!(" ├ {}", colors::italic(&msg));
eprint!(" └ {}", colors::bold("Allow?"));
- eprint!(" {} > ", OPTS);
+ eprint!(" {OPTS} > ");
let value = loop {
let mut input = String::new();
let stdin = std::io::stdin();
@@ -224,13 +224,13 @@ impl PermissionPrompter for TtyPrompter {
match ch.to_ascii_lowercase() {
'y' => {
clear_n_lines(if api_name.is_some() { 4 } else { 3 });
- let msg = format!("Granted {}.", message);
+ let msg = format!("Granted {message}.");
eprintln!("✅ {}", colors::bold(&msg));
break PromptResponse::Allow;
}
'n' => {
clear_n_lines(if api_name.is_some() { 4 } else { 3 });
- let msg = format!("Denied {}.", message);
+ let msg = format!("Denied {message}.");
eprintln!("❌ {}", colors::bold(&msg));
break PromptResponse::Deny;
}
@@ -238,7 +238,7 @@ impl PermissionPrompter for TtyPrompter {
// If we don't get a recognized option try again.
clear_n_lines(1);
eprint!(" └ {}", colors::bold("Unrecognized option. Allow?"));
- eprint!(" {} > ", OPTS);
+ eprint!(" {OPTS} > ");
}
};
};