From 7e7fc1587a503fdf38841ce63f6a5cef042f3825 Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Mon, 4 Nov 2024 10:54:29 -0500 Subject: [PATCH] PR feedback --- crates/turbo-trace/Cargo.toml | 2 +- crates/turbo-trace/src/tracer.rs | 9 +++++++++ crates/turborepo-lib/src/commands/query.rs | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/turbo-trace/Cargo.toml b/crates/turbo-trace/Cargo.toml index aa31a1a209b24..8fb3ed3bd84c7 100644 --- a/crates/turbo-trace/Cargo.toml +++ b/crates/turbo-trace/Cargo.toml @@ -16,7 +16,7 @@ swc_ecma_ast = { workspace = true } swc_ecma_parser = { workspace = true } swc_ecma_visit = { workspace = true } thiserror = { workspace = true } -tokio = { workspace = true } +tokio = { workspace = true, features = ["full"] } tracing = { workspace = true } tracing-subscriber = { workspace = true } turbopath = { workspace = true } diff --git a/crates/turbo-trace/src/tracer.rs b/crates/turbo-trace/src/tracer.rs index f8e3f2466262b..5057c22befd1e 100644 --- a/crates/turbo-trace/src/tracer.rs +++ b/crates/turbo-trace/src/tracer.rs @@ -24,6 +24,11 @@ use crate::import_finder::ImportFinder; #[derive(Debug, Default)] pub struct SeenFile { + // We have to add these because of a Rust bug where dead code analysis + // doesn't work properly in multi-target crates + // (i.e. crates with both a binary and library) + // https://github.com/rust-lang/rust/issues/95513 + #[allow(dead_code)] pub ast: Option, } @@ -60,6 +65,7 @@ pub enum TraceError { } impl TraceResult { + #[allow(dead_code)] pub fn emit_errors(&self) { let handler = Handler::with_tty_emitter( ColorConfig::Auto, @@ -81,6 +87,7 @@ impl TraceResult { } pub struct TraceResult { + #[allow(dead_code)] source_map: Arc, pub errors: Vec, pub files: HashMap, @@ -88,6 +95,7 @@ pub struct TraceResult { /// The type of imports to trace. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[allow(dead_code)] pub enum ImportType { /// Trace all imports. All, @@ -118,6 +126,7 @@ impl Tracer { } } + #[allow(dead_code)] pub fn set_import_type(&mut self, import_type: ImportType) { self.import_type = import_type; } diff --git a/crates/turborepo-lib/src/commands/query.rs b/crates/turborepo-lib/src/commands/query.rs index 2c144752e9b62..6f39804ea57ec 100644 --- a/crates/turborepo-lib/src/commands/query.rs +++ b/crates/turborepo-lib/src/commands/query.rs @@ -81,7 +81,8 @@ pub async fn run( // likely a direct query If it doesn't, it's a file path, so we need to // read it let query = if (trimmed_query.starts_with("query") - || trimmed_query.starts_with("mutation") | trimmed_query.starts_with('{')) + || trimmed_query.starts_with("mutation") + || trimmed_query.starts_with('{')) && trimmed_query.ends_with('}') { query