1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

refactor: remove redundant qualification of symbols in Rust (#15201)

This commit is contained in:
orvit 2022-07-14 16:52:44 -05:00 committed by GitHub
parent 1a7259b04b
commit dbf5e95b59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 33 deletions

View file

@ -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>,
{

View file

@ -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,

View file

@ -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,
);
}

View file

@ -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://")

View file

@ -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);

View file

@ -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,

View file

@ -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(),

View file

@ -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()
});