mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
refactor: remove redundant qualification of symbols in Rust (#15201)
This commit is contained in:
parent
1a7259b04b
commit
dbf5e95b59
8 changed files with 28 additions and 33 deletions
|
@ -38,7 +38,6 @@ use deno_graph::ModuleKind;
|
||||||
use deno_graph::ResolutionError;
|
use deno_graph::ResolutionError;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::result;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ use std::time::Instant;
|
||||||
pub struct Stats(pub Vec<(String, u32)>);
|
pub struct Stats(pub Vec<(String, u32)>);
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Stats {
|
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
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct DebouncedReceiver {
|
||||||
// and so we store this state on the struct to ensure we don't
|
// and so we store this state on the struct to ensure we don't
|
||||||
// lose items if a `recv()` never completes
|
// lose items if a `recv()` never completes
|
||||||
received_items: HashSet<PathBuf>,
|
received_items: HashSet<PathBuf>,
|
||||||
receiver: mpsc::UnboundedReceiver<Vec<PathBuf>>,
|
receiver: UnboundedReceiver<Vec<PathBuf>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DebouncedReceiver {
|
impl DebouncedReceiver {
|
||||||
|
@ -55,7 +55,7 @@ impl DebouncedReceiver {
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
select! {
|
||||||
items = self.receiver.recv() => {
|
items = self.receiver.recv() => {
|
||||||
self.received_items.extend(items?);
|
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
|
/// changes. For example, in the case where we would like to bundle, then `operation` would
|
||||||
/// have the logic for it like bundling the code.
|
/// have the logic for it like bundling the code.
|
||||||
pub async fn watch_func2<T: Clone, O, F>(
|
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,
|
mut operation: O,
|
||||||
operation_args: T,
|
operation_args: T,
|
||||||
print_config: PrintConfig,
|
print_config: PrintConfig,
|
||||||
|
|
|
@ -127,7 +127,7 @@ fn format_maybe_source_line(
|
||||||
if column_number as usize > source_line.len() {
|
if column_number as usize > source_line.len() {
|
||||||
return format!(
|
return format!(
|
||||||
"\n{} Couldn't format source line: Column {} is out of bounds (source may have changed at runtime)",
|
"\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,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ where
|
||||||
{
|
{
|
||||||
let mut prepared = vec![];
|
let mut prepared = vec![];
|
||||||
|
|
||||||
let root_path = std::env::current_dir()?;
|
let root_path = current_dir()?;
|
||||||
for path in include {
|
for path in include {
|
||||||
let lowercase_path = path.to_lowercase();
|
let lowercase_path = path.to_lowercase();
|
||||||
if lowercase_path.starts_with("http://")
|
if lowercase_path.starts_with("http://")
|
||||||
|
|
40
cli/main.rs
40
cli/main.rs
|
@ -175,7 +175,7 @@ fn create_web_worker_callback(
|
||||||
source_map_getter: Some(Box::new(ps.clone())),
|
source_map_getter: Some(Box::new(ps.clone())),
|
||||||
worker_type: args.worker_type,
|
worker_type: args.worker_type,
|
||||||
maybe_inspector_server,
|
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(),
|
blob_store: ps.blob_store.clone(),
|
||||||
broadcast_channel: ps.broadcast_channel.clone(),
|
broadcast_channel: ps.broadcast_channel.clone(),
|
||||||
shared_array_buffer_store: Some(ps.shared_array_buffer_store.clone()),
|
shared_array_buffer_store: Some(ps.shared_array_buffer_store.clone()),
|
||||||
|
@ -255,7 +255,7 @@ pub fn create_main_worker(
|
||||||
maybe_inspector_server,
|
maybe_inspector_server,
|
||||||
should_break_on_first_statement,
|
should_break_on_first_statement,
|
||||||
module_loader,
|
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,
|
origin_storage_dir,
|
||||||
blob_store: ps.blob_store.clone(),
|
blob_store: ps.blob_store.clone(),
|
||||||
broadcast_channel: ps.broadcast_channel.clone(),
|
broadcast_channel: ps.broadcast_channel.clone(),
|
||||||
|
@ -363,23 +363,23 @@ fn print_cache_info(
|
||||||
|
|
||||||
pub fn get_types(unstable: bool) -> String {
|
pub fn get_types(unstable: bool) -> String {
|
||||||
let mut types = vec![
|
let mut types = vec![
|
||||||
crate::tsc::DENO_NS_LIB,
|
tsc::DENO_NS_LIB,
|
||||||
crate::tsc::DENO_CONSOLE_LIB,
|
tsc::DENO_CONSOLE_LIB,
|
||||||
crate::tsc::DENO_URL_LIB,
|
tsc::DENO_URL_LIB,
|
||||||
crate::tsc::DENO_WEB_LIB,
|
tsc::DENO_WEB_LIB,
|
||||||
crate::tsc::DENO_FETCH_LIB,
|
tsc::DENO_FETCH_LIB,
|
||||||
crate::tsc::DENO_WEBGPU_LIB,
|
tsc::DENO_WEBGPU_LIB,
|
||||||
crate::tsc::DENO_WEBSOCKET_LIB,
|
tsc::DENO_WEBSOCKET_LIB,
|
||||||
crate::tsc::DENO_WEBSTORAGE_LIB,
|
tsc::DENO_WEBSTORAGE_LIB,
|
||||||
crate::tsc::DENO_CRYPTO_LIB,
|
tsc::DENO_CRYPTO_LIB,
|
||||||
crate::tsc::DENO_BROADCAST_CHANNEL_LIB,
|
tsc::DENO_BROADCAST_CHANNEL_LIB,
|
||||||
crate::tsc::DENO_NET_LIB,
|
tsc::DENO_NET_LIB,
|
||||||
crate::tsc::SHARED_GLOBALS_LIB,
|
tsc::SHARED_GLOBALS_LIB,
|
||||||
crate::tsc::WINDOW_LIB,
|
tsc::WINDOW_LIB,
|
||||||
];
|
];
|
||||||
|
|
||||||
if unstable {
|
if unstable {
|
||||||
types.push(crate::tsc::UNSTABLE_NS_LIB);
|
types.push(tsc::UNSTABLE_NS_LIB);
|
||||||
}
|
}
|
||||||
|
|
||||||
types.join("\n")
|
types.join("\n")
|
||||||
|
@ -1317,13 +1317,9 @@ fn setup_panic_hook() {
|
||||||
eprintln!("reproduction steps and re-run with the RUST_BACKTRACE=1 env");
|
eprintln!("reproduction steps and re-run with the RUST_BACKTRACE=1 env");
|
||||||
eprintln!("var set and include the backtrace in your report.");
|
eprintln!("var set and include the backtrace in your report.");
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!(
|
eprintln!("Platform: {} {}", env::consts::OS, env::consts::ARCH);
|
||||||
"Platform: {} {}",
|
|
||||||
std::env::consts::OS,
|
|
||||||
std::env::consts::ARCH
|
|
||||||
);
|
|
||||||
eprintln!("Version: {}", version::deno());
|
eprintln!("Version: {}", version::deno());
|
||||||
eprintln!("Args: {:?}", std::env::args().collect::<Vec<_>>());
|
eprintln!("Args: {:?}", env::args().collect::<Vec<_>>());
|
||||||
eprintln!();
|
eprintln!();
|
||||||
orig_hook(panic_info);
|
orig_hook(panic_info);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
|
|
|
@ -421,7 +421,7 @@ impl ProcState {
|
||||||
self.options.resolve_ts_config_for_emit(config_type)?;
|
self.options.resolve_ts_config_for_emit(config_type)?;
|
||||||
|
|
||||||
if let Some(ignored_options) = ts_config_result.maybe_ignored_options {
|
if let Some(ignored_options) = ts_config_result.maybe_ignored_options {
|
||||||
log::warn!("{}", ignored_options);
|
warn!("{}", ignored_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start type checking if necessary
|
// start type checking if necessary
|
||||||
|
@ -626,7 +626,7 @@ impl ProcState {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(
|
Ok(
|
||||||
deno_graph::create_graph(
|
create_graph(
|
||||||
roots,
|
roots,
|
||||||
false,
|
false,
|
||||||
maybe_imports,
|
maybe_imports,
|
||||||
|
|
|
@ -274,7 +274,7 @@ pub async fn run(
|
||||||
cpu_count: std::thread::available_parallelism()
|
cpu_count: std::thread::available_parallelism()
|
||||||
.map(|p| p.get())
|
.map(|p| p.get())
|
||||||
.unwrap_or(1),
|
.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,
|
enable_testing_features: false,
|
||||||
location: metadata.location,
|
location: metadata.location,
|
||||||
no_color: !colors::use_color(),
|
no_color: !colors::use_color(),
|
||||||
|
|
|
@ -798,7 +798,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compiler_snapshot() {
|
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()),
|
startup_snapshot: Some(compiler_snapshot()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue