summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-01-14 20:18:58 -0800
committerGitHub <noreply@github.com>2023-01-14 23:18:58 -0500
commitd5634164cb86771fc279468cbb93e311c1ad3089 (patch)
tree2878a536acdb5106e48488e640cd78dfa2b5893a /cli
parentefcbfd5206fcdfac55c26a7133c04dd330d047b9 (diff)
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699 Closes https://github.com/denoland/deno/issues/2347 Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not need to switch the cargo toolchain to nightly. Do we care about formatting stability of our codebase across Rust versions? (I don't)
Diffstat (limited to 'cli')
-rw-r--r--cli/args/flags.rs5
-rw-r--r--cli/args/flags_allow_net.rs3
-rw-r--r--cli/bench/http.rs11
-rw-r--r--cli/cache/deno_dir.rs7
-rw-r--r--cli/lsp/semantic_tokens.rs3
-rw-r--r--cli/napi/sym/README.md5
-rw-r--r--cli/tests/integration/fmt_tests.rs3
-rw-r--r--cli/tests/integration/inspector_tests.rs3
-rw-r--r--cli/tests/integration/repl_tests.rs3
-rw-r--r--cli/tests/integration/upgrade_tests.rs3
-rw-r--r--cli/tools/coverage/mod.rs4
-rw-r--r--cli/tools/repl/editor.rs8
-rw-r--r--cli/util/diff.rs3
-rw-r--r--cli/worker.rs3
14 files changed, 47 insertions, 17 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index ef1aedce4..903f93639 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -2401,7 +2401,10 @@ fn completions_parse(
mut app: clap::Command,
) {
use clap_complete::generate;
- use clap_complete::shells::{Bash, Fish, PowerShell, Zsh};
+ use clap_complete::shells::Bash;
+ use clap_complete::shells::Fish;
+ use clap_complete::shells::PowerShell;
+ use clap_complete::shells::Zsh;
use clap_complete_fig::Fig;
let mut buf: Vec<u8> = vec![];
diff --git a/cli/args/flags_allow_net.rs b/cli/args/flags_allow_net.rs
index 38a4ac83a..bf189132a 100644
--- a/cli/args/flags_allow_net.rs
+++ b/cli/args/flags_allow_net.rs
@@ -64,7 +64,8 @@ pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> {
#[cfg(test)]
mod bare_port_tests {
- use super::{BarePort, ParsePortError};
+ use super::BarePort;
+ use super::ParsePortError;
#[test]
fn bare_port_parsed() {
diff --git a/cli/bench/http.rs b/cli/bench/http.rs
index 7c416f93c..585574e2d 100644
--- a/cli/bench/http.rs
+++ b/cli/bench/http.rs
@@ -1,11 +1,16 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use std::sync::atomic::{AtomicU16, Ordering};
-use std::{collections::HashMap, path::Path, process::Command, time::Duration};
+use std::collections::HashMap;
+use std::path::Path;
+use std::process::Command;
+use std::sync::atomic::AtomicU16;
+use std::sync::atomic::Ordering;
+use std::time::Duration;
use super::Result;
-pub use test_util::{parse_wrk_output, WrkOutput as HttpBenchmarkResult};
+pub use test_util::parse_wrk_output;
+pub use test_util::WrkOutput as HttpBenchmarkResult;
// Some of the benchmarks in this file have been renamed. In case the history
// somehow gets messed up:
// "node_http" was once called "node"
diff --git a/cli/cache/deno_dir.rs b/cli/cache/deno_dir.rs
index e802aaacb..86f3e00b5 100644
--- a/cli/cache/deno_dir.rs
+++ b/cli/cache/deno_dir.rs
@@ -184,7 +184,12 @@ mod dirs {
use std::os::windows::ffi::OsStringExt;
use std::path::PathBuf;
use winapi::shared::winerror;
- use winapi::um::{combaseapi, knownfolders, shlobj, shtypes, winbase, winnt};
+ use winapi::um::combaseapi;
+ use winapi::um::knownfolders;
+ use winapi::um::shlobj;
+ use winapi::um::shtypes;
+ use winapi::um::winbase;
+ use winapi::um::winnt;
fn known_folder(folder_id: shtypes::REFKNOWNFOLDERID) -> Option<PathBuf> {
// SAFETY: winapi calls
diff --git a/cli/lsp/semantic_tokens.rs b/cli/lsp/semantic_tokens.rs
index 8ed0ab201..772327a66 100644
--- a/cli/lsp/semantic_tokens.rs
+++ b/cli/lsp/semantic_tokens.rs
@@ -5,7 +5,8 @@
// and https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostTypes.ts
// for the SemanticTokensBuilder implementation.
-use std::ops::{Index, IndexMut};
+use std::ops::Index;
+use std::ops::IndexMut;
use tower_lsp::lsp_types::SemanticToken;
use tower_lsp::lsp_types::SemanticTokenModifier;
use tower_lsp::lsp_types::SemanticTokenType;
diff --git a/cli/napi/sym/README.md b/cli/napi/sym/README.md
index b3e2ab43b..de08a8e17 100644
--- a/cli/napi/sym/README.md
+++ b/cli/napi/sym/README.md
@@ -8,7 +8,10 @@ A proc_macro for Deno's Node-API implementation. It does the following things:
- Maps `deno_napi::Result` to raw `napi_result`.
```rust
-use deno_napi::{napi_value, Env, Error, Result};
+use deno_napi::napi_value;
+use deno_napi::Env;
+use deno_napi::Error;
+use deno_napi::Result;
#[napi_sym::napi_sym]
fn napi_get_boolean(
diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs
index 5c21b2b7d..144c2b56c 100644
--- a/cli/tests/integration/fmt_tests.rs
+++ b/cli/tests/integration/fmt_tests.rs
@@ -126,7 +126,8 @@ fn fmt_ignore_unexplicit_files() {
#[test]
fn fmt_auto_ignore_git_and_node_modules() {
- use std::fs::{create_dir_all, File};
+ use std::fs::create_dir_all;
+ use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn create_bad_json(t: PathBuf) {
diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs
index af1325d64..e291c17bb 100644
--- a/cli/tests/integration/inspector_tests.rs
+++ b/cli/tests/integration/inspector_tests.rs
@@ -211,7 +211,8 @@ fn assert_stderr(
}
fn inspect_flag_with_unique_port(flag_prefix: &str) -> String {
- use std::sync::atomic::{AtomicU16, Ordering};
+ use std::sync::atomic::AtomicU16;
+ use std::sync::atomic::Ordering;
static PORT: AtomicU16 = AtomicU16::new(9229);
let port = PORT.fetch_add(1, Ordering::Relaxed);
format!("{}=127.0.0.1:{}", flag_prefix, port)
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index df31ee98b..af9fce187 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -602,7 +602,8 @@ fn lexical_scoped_variable() {
#[test]
fn missing_deno_dir() {
- use std::fs::{read_dir, remove_dir_all};
+ use std::fs::read_dir;
+ use std::fs::remove_dir_all;
const DENO_DIR: &str = "nonexistent";
let test_deno_dir = test_util::testdata_path().join(DENO_DIR);
let (out, err) = util::run_and_collect_output(
diff --git a/cli/tests/integration/upgrade_tests.rs b/cli/tests/integration/upgrade_tests.rs
index 2822bc8de..f4eaa03c9 100644
--- a/cli/tests/integration/upgrade_tests.rs
+++ b/cli/tests/integration/upgrade_tests.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use std::process::{Command, Stdio};
+use std::process::Command;
+use std::process::Stdio;
use test_util as util;
use test_util::TempDir;
diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs
index cbb2bd9cc..056ed4ab4 100644
--- a/cli/tools/coverage/mod.rs
+++ b/cli/tools/coverage/mod.rs
@@ -24,7 +24,9 @@ use regex::Regex;
use std::fs;
use std::fs::File;
use std::io::BufWriter;
-use std::io::{self, Error, Write};
+use std::io::Error;
+use std::io::Write;
+use std::io::{self};
use std::path::PathBuf;
use text_lines::TextLines;
use uuid::Uuid;
diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs
index a40b6fcd1..9957d1eaf 100644
--- a/cli/tools/repl/editor.rs
+++ b/cli/tools/repl/editor.rs
@@ -18,15 +18,19 @@ use rustyline::validate::ValidationResult;
use rustyline::validate::Validator;
use rustyline::Cmd;
use rustyline::CompletionType;
+use rustyline::ConditionalEventHandler;
use rustyline::Config;
use rustyline::Context;
use rustyline::Editor;
+use rustyline::Event;
+use rustyline::EventContext;
use rustyline::EventHandler;
use rustyline::KeyCode;
use rustyline::KeyEvent;
use rustyline::Modifiers;
-use rustyline::{ConditionalEventHandler, Event, EventContext, RepeatCount};
-use rustyline_derive::{Helper, Hinter};
+use rustyline::RepeatCount;
+use rustyline_derive::Helper;
+use rustyline_derive::Hinter;
use std::borrow::Cow;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
diff --git a/cli/util/diff.rs b/cli/util/diff.rs
index 3dbe8a6ff..817ddfd89 100644
--- a/cli/util/diff.rs
+++ b/cli/util/diff.rs
@@ -1,7 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use crate::colors;
-use dissimilar::{diff as difference, Chunk};
+use dissimilar::diff as difference;
+use dissimilar::Chunk;
use std::fmt::Write as _;
/// Print diff of the same file_path, before and after formatting.
diff --git a/cli/worker.rs b/cli/worker.rs
index e34c65d66..b6ebd7930 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -729,7 +729,8 @@ fn create_web_worker_callback(
#[cfg(test)]
mod tests {
use super::*;
- use deno_core::{resolve_url_or_path, FsModuleLoader};
+ use deno_core::resolve_url_or_path;
+ use deno_core::FsModuleLoader;
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::permissions::Permissions;