Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Nov 4, 2024
1 parent fd64d7f commit 7e7fc15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/turbo-trace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
9 changes: 9 additions & 0 deletions crates/turbo-trace/src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<swc_ecma_ast::Module>,
}

Expand Down Expand Up @@ -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,
Expand All @@ -81,13 +87,15 @@ impl TraceResult {
}

pub struct TraceResult {
#[allow(dead_code)]
source_map: Arc<SourceMap>,
pub errors: Vec<TraceError>,
pub files: HashMap<AbsoluteSystemPathBuf, SeenFile>,
}

/// The type of imports to trace.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(dead_code)]
pub enum ImportType {
/// Trace all imports.
All,
Expand Down Expand Up @@ -118,6 +126,7 @@ impl Tracer {
}
}

#[allow(dead_code)]
pub fn set_import_type(&mut self, import_type: ImportType) {
self.import_type = import_type;
}
Expand Down
3 changes: 2 additions & 1 deletion crates/turborepo-lib/src/commands/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e7fc15

Please sign in to comment.