Skip to content

Commit

Permalink
chore: cargo fmt - turn on group_imports=StdExternalCrate (#26646)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Dec 31, 2024
1 parent 88bd5f0 commit ac7b33a
Show file tree
Hide file tree
Showing 298 changed files with 2,104 additions and 1,895 deletions.
2 changes: 1 addition & 1 deletion .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"exec": {
"commands": [{
"command": "rustfmt --config imports_granularity=item",
"command": "rustfmt --config imports_granularity=item --config group_imports=StdExternalCrate",
"exts": ["rs"]
}]
},
Expand Down
1 change: 0 additions & 1 deletion bench_util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use deno_bench_util::bench_js_sync;
use deno_bench_util::bench_or_profile;
use deno_bench_util::bencher::benchmark_group;
use deno_bench_util::bencher::Bencher;

use deno_core::Extension;

#[op2]
Expand Down
8 changes: 4 additions & 4 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ use log::Level;
use serde::Deserialize;
use serde::Serialize;

use crate::args::resolve_no_prompt;
use crate::util::fs::canonicalize_path;

use super::flags_net;
use super::jsr_url;
use crate::args::resolve_no_prompt;
use crate::util::fs::canonicalize_path;

#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub enum ConfigFlag {
Expand Down Expand Up @@ -6059,9 +6058,10 @@ pub fn resolve_urls(urls: Vec<String>) -> Vec<String> {

#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;

use super::*;

/// Creates vector of strings, Vec<String>
macro_rules! svec {
($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]);
Expand Down
5 changes: 3 additions & 2 deletions cli/args/flags_net.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use deno_core::url::Url;
use deno_runtime::deno_permissions::NetDescriptor;
use std::net::IpAddr;
use std::str::FromStr;

use deno_core::url::Url;
use deno_runtime::deno_permissions::NetDescriptor;

#[derive(Debug, PartialEq, Eq)]
pub struct ParsePortError(String);

Expand Down
8 changes: 3 additions & 5 deletions cli/args/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex;
use deno_core::parking_lot::MutexGuard;
use deno_core::serde_json;
use deno_lockfile::Lockfile;
use deno_lockfile::WorkspaceMemberConfig;
use deno_package_json::PackageJsonDepValue;
use deno_path_util::fs::atomic_write_file_with_retries;
use deno_runtime::deno_node::PackageJson;
use deno_semver::jsr::JsrDepPackageReq;

use crate::args::deno_json::import_map_deps;
use crate::args::DenoSubcommand;
use crate::args::InstallFlags;
use crate::cache;
use crate::sys::CliSys;
use crate::Flags;

use crate::args::DenoSubcommand;
use crate::args::InstallFlags;

use deno_lockfile::Lockfile;

#[derive(Debug)]
pub struct CliLockfileReadFromPathOptions {
pub file_path: PathBuf,
Expand Down
88 changes: 43 additions & 45 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,37 @@ mod import_map;
mod lockfile;
mod package_json;

use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
use std::io::BufReader;
use std::io::Cursor;
use std::io::Read;
use std::io::Seek;
use std::net::SocketAddr;
use std::num::NonZeroUsize;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;

use deno_ast::MediaType;
use deno_ast::ModuleSpecifier;
use deno_ast::SourceMapOption;
use deno_cache_dir::file_fetcher::CacheSetting;
pub use deno_config::deno_json::BenchConfig;
pub use deno_config::deno_json::ConfigFile;
use deno_config::deno_json::FmtConfig;
pub use deno_config::deno_json::FmtOptionsConfig;
use deno_config::deno_json::LintConfig;
pub use deno_config::deno_json::LintRulesConfig;
use deno_config::deno_json::NodeModulesDirMode;
pub use deno_config::deno_json::ProseWrap;
use deno_config::deno_json::TestConfig;
pub use deno_config::deno_json::TsConfig;
pub use deno_config::deno_json::TsConfigForEmit;
pub use deno_config::deno_json::TsConfigType;
pub use deno_config::deno_json::TsTypeLib;
pub use deno_config::glob::FilePatterns;
use deno_config::workspace::CreateResolverOptions;
use deno_config::workspace::FolderConfigs;
use deno_config::workspace::PackageJsonDepResolution;
Expand All @@ -22,67 +49,42 @@ use deno_config::workspace::WorkspaceDiscoverOptions;
use deno_config::workspace::WorkspaceDiscoverStart;
use deno_config::workspace::WorkspaceLintConfig;
use deno_config::workspace::WorkspaceResolver;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::serde_json;
use deno_core::url::Url;
use deno_graph::GraphKind;
pub use deno_json::check_warn_tsconfig;
use deno_lint::linter::LintConfig as DenoLintConfig;
use deno_npm::npm_rc::NpmRc;
use deno_npm::npm_rc::ResolvedNpmRc;
use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmSystemInfo;
use deno_path_util::normalize_path;
use deno_semver::npm::NpmPackageReqReference;
use deno_semver::StackString;
use deno_telemetry::OtelConfig;
use deno_telemetry::OtelRuntimeConfig;
use import_map::resolve_import_map_value_from_specifier;

pub use deno_config::deno_json::BenchConfig;
pub use deno_config::deno_json::ConfigFile;
pub use deno_config::deno_json::FmtOptionsConfig;
pub use deno_config::deno_json::LintRulesConfig;
pub use deno_config::deno_json::ProseWrap;
pub use deno_config::deno_json::TsConfig;
pub use deno_config::deno_json::TsConfigForEmit;
pub use deno_config::deno_json::TsConfigType;
pub use deno_config::deno_json::TsTypeLib;
pub use deno_config::glob::FilePatterns;
pub use deno_json::check_warn_tsconfig;
pub use flags::*;
pub use lockfile::CliLockfile;
pub use lockfile::CliLockfileReadFromPathOptions;
pub use package_json::NpmInstallDepsProvider;
pub use package_json::PackageJsonDepValueParseWithLocationError;

use deno_ast::ModuleSpecifier;
use deno_core::anyhow::bail;
use deno_core::anyhow::Context;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::url::Url;
use deno_runtime::deno_permissions::PermissionsOptions;
use deno_runtime::deno_tls::deno_native_certs::load_native_certs;
use deno_runtime::deno_tls::rustls;
use deno_runtime::deno_tls::rustls::RootCertStore;
use deno_runtime::deno_tls::rustls_pemfile;
use deno_runtime::deno_tls::webpki_roots;
use deno_runtime::inspector_server::InspectorServer;
use deno_semver::npm::NpmPackageReqReference;
use deno_semver::StackString;
use deno_telemetry::OtelConfig;
use deno_telemetry::OtelRuntimeConfig;
use deno_terminal::colors;
use dotenvy::from_filename;
pub use flags::*;
use import_map::resolve_import_map_value_from_specifier;
pub use lockfile::CliLockfile;
pub use lockfile::CliLockfileReadFromPathOptions;
use once_cell::sync::Lazy;
pub use package_json::NpmInstallDepsProvider;
pub use package_json::PackageJsonDepValueParseWithLocationError;
use serde::Deserialize;
use serde::Serialize;
use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
use std::io::BufReader;
use std::io::Cursor;
use std::io::Read;
use std::io::Seek;
use std::net::SocketAddr;
use std::num::NonZeroUsize;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use sys_traits::EnvHomeDir;
use thiserror::Error;

Expand All @@ -92,10 +94,6 @@ use crate::sys::CliSys;
use crate::util::fs::canonicalize_path_maybe_not_exists;
use crate::version;

use deno_config::deno_json::FmtConfig;
use deno_config::deno_json::LintConfig;
use deno_config::deno_json::TestConfig;

pub fn npm_registry_url() -> &'static Url {
static NPM_REGISTRY_DEFAULT_URL: Lazy<Url> = Lazy::new(|| {
let env_var_name = "NPM_CONFIG_REGISTRY";
Expand Down
9 changes: 5 additions & 4 deletions cli/bench/lsp.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use std::collections::HashMap;
use std::path::Path;
use std::str::FromStr;
use std::time::Duration;

use deno_core::serde::Deserialize;
use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use lsp_types::Uri;
use std::collections::HashMap;
use std::path::Path;
use std::str::FromStr;
use std::time::Duration;
use test_util::lsp::LspClientBuilder;
use test_util::PathRef;
use tower_lsp::lsp_types as lsp;
Expand Down
7 changes: 4 additions & 3 deletions cli/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
#![allow(clippy::print_stdout)]
#![allow(clippy::print_stderr)]

use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::Value;
use std::collections::HashMap;
use std::convert::From;
use std::env;
Expand All @@ -15,6 +12,10 @@ use std::path::PathBuf;
use std::process::Command;
use std::process::Stdio;
use std::time::SystemTime;

use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::serde_json::Value;
use test_util::PathRef;

mod lsp;
Expand Down
12 changes: 7 additions & 5 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ use deno_runtime::*;
mod shared;

mod ts {
use super::*;
use std::collections::HashMap;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;

use deno_core::error::custom_error;
use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::OpState;
use serde::Serialize;
use std::collections::HashMap;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;

use super::*;

#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
Expand Down
9 changes: 5 additions & 4 deletions cli/cache/cache_db.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use std::io::IsTerminal;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;

use deno_core::error::AnyError;
use deno_core::parking_lot::Mutex;
use deno_core::parking_lot::MutexGuard;
Expand All @@ -9,10 +14,6 @@ use deno_runtime::deno_webstorage::rusqlite::Connection;
use deno_runtime::deno_webstorage::rusqlite::OptionalExtension;
use deno_runtime::deno_webstorage::rusqlite::Params;
use once_cell::sync::OnceCell;
use std::io::IsTerminal;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;

use super::FastInsecureHasher;

Expand Down
7 changes: 4 additions & 3 deletions cli/cache/check.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_runtime::deno_webstorage::rusqlite::params;

use super::cache_db::CacheDB;
use super::cache_db::CacheDBConfiguration;
use super::cache_db::CacheDBHash;
use super::cache_db::CacheFailure;
use deno_ast::ModuleSpecifier;
use deno_core::error::AnyError;
use deno_runtime::deno_webstorage::rusqlite::params;

pub static TYPE_CHECK_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
table_initializer: concat!(
Expand Down
3 changes: 1 addition & 2 deletions cli/cache/code_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ use deno_core::error::AnyError;
use deno_runtime::code_cache;
use deno_runtime::deno_webstorage::rusqlite::params;

use crate::worker::CliCodeCache;

use super::cache_db::CacheDB;
use super::cache_db::CacheDBConfiguration;
use super::cache_db::CacheDBHash;
use super::cache_db::CacheFailure;
use crate::worker::CliCodeCache;

pub static CODE_CACHE_DB: CacheDBConfiguration = CacheDBConfiguration {
table_initializer: concat!(
Expand Down
9 changes: 4 additions & 5 deletions cli/cache/deno_dir.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use std::env;
use std::path::PathBuf;

use deno_cache_dir::DenoDirResolutionError;
use once_cell::sync::OnceCell;

use crate::sys::CliSys;

use super::DiskCache;

use std::env;
use std::path::PathBuf;
use crate::sys::CliSys;

/// Lazily creates the deno dir which might be useful in scenarios
/// where functionality wants to continue if the DENO_DIR can't be created.
Expand Down
19 changes: 10 additions & 9 deletions cli/cache/disk_cache.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use crate::sys::CliSys;

use super::CACHE_PERM;

use deno_cache_dir::url_to_filename;
use deno_core::url::Host;
use deno_core::url::Url;
use deno_path_util::fs::atomic_write_file_with_retries;
use std::ffi::OsStr;
use std::fs;
use std::path::Component;
Expand All @@ -16,6 +8,14 @@ use std::path::PathBuf;
use std::path::Prefix;
use std::str;

use deno_cache_dir::url_to_filename;
use deno_core::url::Host;
use deno_core::url::Url;
use deno_path_util::fs::atomic_write_file_with_retries;

use super::CACHE_PERM;
use crate::sys::CliSys;

#[derive(Debug, Clone)]
pub struct DiskCache {
sys: CliSys,
Expand Down Expand Up @@ -130,9 +130,10 @@ impl DiskCache {

#[cfg(test)]
mod tests {
use super::*;
use test_util::TempDir;

use super::*;

#[test]
fn test_set_get_cache_file() {
let temp_dir = TempDir::new();
Expand Down
Loading

0 comments on commit ac7b33a

Please sign in to comment.