diff options
author | orvit <cdavis4short@gmail.com> | 2022-07-14 16:52:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 07:52:44 +1000 |
commit | dbf5e95b59656b05f28218a27d128cae9fd68342 (patch) | |
tree | a5aa4d6cde6f39c2439036eb73243c46d2a6a63e | |
parent | 1a7259b04b7229f6350a7a7c21b50497b5c80c17 (diff) |
refactor: remove redundant qualification of symbols in Rust (#15201)
-rw-r--r-- | cli/emit.rs | 3 | ||||
-rw-r--r-- | cli/file_watcher.rs | 6 | ||||
-rw-r--r-- | cli/fmt_errors.rs | 2 | ||||
-rw-r--r-- | cli/fs_util.rs | 2 | ||||
-rw-r--r-- | cli/main.rs | 40 | ||||
-rw-r--r-- | cli/proc_state.rs | 4 | ||||
-rw-r--r-- | cli/standalone.rs | 2 | ||||
-rw-r--r-- | cli/tsc.rs | 2 |
8 files changed, 28 insertions, 33 deletions
diff --git a/cli/emit.rs b/cli/emit.rs index c7a31fc0f..584593869 100644 --- a/cli/emit.rs +++ b/cli/emit.rs @@ -38,7 +38,6 @@ use deno_graph::ModuleKind; use deno_graph::ResolutionError; use std::collections::HashSet; use std::fmt; -use std::result; use std::sync::Arc; use std::time::Instant; @@ -47,7 +46,7 @@ use std::time::Instant; pub struct Stats(pub Vec<(String, u32)>); impl<'de> Deserialize<'de> for Stats { - fn deserialize<D>(deserializer: D) -> result::Result<Self, D::Error> + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de>, { diff --git a/cli/file_watcher.rs b/cli/file_watcher.rs index 60627548e..0f9f7d1ff 100644 --- a/cli/file_watcher.rs +++ b/cli/file_watcher.rs @@ -32,7 +32,7 @@ struct DebouncedReceiver { // and so we store this state on the struct to ensure we don't // lose items if a `recv()` never completes received_items: HashSet<PathBuf>, - receiver: mpsc::UnboundedReceiver<Vec<PathBuf>>, + receiver: UnboundedReceiver<Vec<PathBuf>>, } impl DebouncedReceiver { @@ -55,7 +55,7 @@ impl DebouncedReceiver { } loop { - tokio::select! { + select! { items = self.receiver.recv() => { self.received_items.extend(items?); } @@ -255,7 +255,7 @@ where /// changes. For example, in the case where we would like to bundle, then `operation` would /// have the logic for it like bundling the code. pub async fn watch_func2<T: Clone, O, F>( - mut paths_to_watch_receiver: mpsc::UnboundedReceiver<Vec<PathBuf>>, + mut paths_to_watch_receiver: UnboundedReceiver<Vec<PathBuf>>, mut operation: O, operation_args: T, print_config: PrintConfig, diff --git a/cli/fmt_errors.rs b/cli/fmt_errors.rs index 759850cec..53cf975bc 100644 --- a/cli/fmt_errors.rs +++ b/cli/fmt_errors.rs @@ -127,7 +127,7 @@ fn format_maybe_source_line( if column_number as usize > source_line.len() { return format!( "\n{} Couldn't format source line: Column {} is out of bounds (source may have changed at runtime)", - crate::colors::yellow("Warning"), column_number, + yellow("Warning"), column_number, ); } diff --git a/cli/fs_util.rs b/cli/fs_util.rs index 53406351b..322b3f9e7 100644 --- a/cli/fs_util.rs +++ b/cli/fs_util.rs @@ -249,7 +249,7 @@ where { let mut prepared = vec![]; - let root_path = std::env::current_dir()?; + let root_path = current_dir()?; for path in include { let lowercase_path = path.to_lowercase(); if lowercase_path.starts_with("http://") diff --git a/cli/main.rs b/cli/main.rs index 2cdd65ed2..55416e0e4 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -175,7 +175,7 @@ fn create_web_worker_callback( source_map_getter: Some(Box::new(ps.clone())), worker_type: args.worker_type, maybe_inspector_server, - get_error_class_fn: Some(&crate::errors::get_error_class_name), + get_error_class_fn: Some(&errors::get_error_class_name), blob_store: ps.blob_store.clone(), broadcast_channel: ps.broadcast_channel.clone(), shared_array_buffer_store: Some(ps.shared_array_buffer_store.clone()), @@ -255,7 +255,7 @@ pub fn create_main_worker( maybe_inspector_server, should_break_on_first_statement, module_loader, - get_error_class_fn: Some(&crate::errors::get_error_class_name), + get_error_class_fn: Some(&errors::get_error_class_name), origin_storage_dir, blob_store: ps.blob_store.clone(), broadcast_channel: ps.broadcast_channel.clone(), @@ -363,23 +363,23 @@ fn print_cache_info( pub fn get_types(unstable: bool) -> String { let mut types = vec![ - crate::tsc::DENO_NS_LIB, - crate::tsc::DENO_CONSOLE_LIB, - crate::tsc::DENO_URL_LIB, - crate::tsc::DENO_WEB_LIB, - crate::tsc::DENO_FETCH_LIB, - crate::tsc::DENO_WEBGPU_LIB, - crate::tsc::DENO_WEBSOCKET_LIB, - crate::tsc::DENO_WEBSTORAGE_LIB, - crate::tsc::DENO_CRYPTO_LIB, - crate::tsc::DENO_BROADCAST_CHANNEL_LIB, - crate::tsc::DENO_NET_LIB, - crate::tsc::SHARED_GLOBALS_LIB, - crate::tsc::WINDOW_LIB, + tsc::DENO_NS_LIB, + tsc::DENO_CONSOLE_LIB, + tsc::DENO_URL_LIB, + tsc::DENO_WEB_LIB, + tsc::DENO_FETCH_LIB, + tsc::DENO_WEBGPU_LIB, + tsc::DENO_WEBSOCKET_LIB, + tsc::DENO_WEBSTORAGE_LIB, + tsc::DENO_CRYPTO_LIB, + tsc::DENO_BROADCAST_CHANNEL_LIB, + tsc::DENO_NET_LIB, + tsc::SHARED_GLOBALS_LIB, + tsc::WINDOW_LIB, ]; if unstable { - types.push(crate::tsc::UNSTABLE_NS_LIB); + types.push(tsc::UNSTABLE_NS_LIB); } types.join("\n") @@ -1317,13 +1317,9 @@ fn setup_panic_hook() { eprintln!("reproduction steps and re-run with the RUST_BACKTRACE=1 env"); eprintln!("var set and include the backtrace in your report."); eprintln!(); - eprintln!( - "Platform: {} {}", - std::env::consts::OS, - std::env::consts::ARCH - ); + eprintln!("Platform: {} {}", env::consts::OS, env::consts::ARCH); eprintln!("Version: {}", version::deno()); - eprintln!("Args: {:?}", std::env::args().collect::<Vec<_>>()); + eprintln!("Args: {:?}", env::args().collect::<Vec<_>>()); eprintln!(); orig_hook(panic_info); std::process::exit(1); diff --git a/cli/proc_state.rs b/cli/proc_state.rs index ae0290b2c..bb51b6f1a 100644 --- a/cli/proc_state.rs +++ b/cli/proc_state.rs @@ -421,7 +421,7 @@ impl ProcState { self.options.resolve_ts_config_for_emit(config_type)?; if let Some(ignored_options) = ts_config_result.maybe_ignored_options { - log::warn!("{}", ignored_options); + warn!("{}", ignored_options); } // start type checking if necessary @@ -626,7 +626,7 @@ impl ProcState { }; Ok( - deno_graph::create_graph( + create_graph( roots, false, maybe_imports, diff --git a/cli/standalone.rs b/cli/standalone.rs index cd5390d2d..72b9b5ef7 100644 --- a/cli/standalone.rs +++ b/cli/standalone.rs @@ -274,7 +274,7 @@ pub async fn run( cpu_count: std::thread::available_parallelism() .map(|p| p.get()) .unwrap_or(1), - debug_flag: metadata.log_level.map_or(false, |l| l == log::Level::Debug), + debug_flag: metadata.log_level.map_or(false, |l| l == Level::Debug), enable_testing_features: false, location: metadata.location, no_color: !colors::use_color(), diff --git a/cli/tsc.rs b/cli/tsc.rs index e3001583b..633b4cd30 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -798,7 +798,7 @@ mod tests { #[test] fn test_compiler_snapshot() { - let mut js_runtime = deno_core::JsRuntime::new(deno_core::RuntimeOptions { + let mut js_runtime = JsRuntime::new(RuntimeOptions { startup_snapshot: Some(compiler_snapshot()), ..Default::default() }); |