diff --git a/tools/hermes/src/charon.rs b/tools/hermes/src/charon.rs index 7096783802..6798fb533c 100644 --- a/tools/hermes/src/charon.rs +++ b/tools/hermes/src/charon.rs @@ -116,11 +116,7 @@ pub fn run_charon(args: &Args, roots: &Roots, packages: &[HermesArtifact]) -> Re if let Some(stdout) = child.stdout.take() { let reader = BufReader::new(stdout); - let mut mapper = crate::diagnostics::DiagnosticMapper::new( - roots.workspace.clone(), - roots.workspace.clone(), - ); - + let mut mapper = crate::diagnostics::DiagnosticMapper::new(roots.workspace.clone()); for line in reader.lines() { if let Ok(line) = line { if let Ok(msg) = serde_json::from_str::(&line) { diff --git a/tools/hermes/src/diagnostics.rs b/tools/hermes/src/diagnostics.rs index a971d9b0af..cca4e656ad 100644 --- a/tools/hermes/src/diagnostics.rs +++ b/tools/hermes/src/diagnostics.rs @@ -9,7 +9,6 @@ use miette::{NamedSource, Report, SourceOffset}; use thiserror::Error; pub struct DiagnosticMapper { - shadow_root: PathBuf, user_root: PathBuf, user_root_canonical: PathBuf, source_cache: HashMap, @@ -53,10 +52,10 @@ impl miette::Diagnostic for MappedError { } impl DiagnosticMapper { - pub fn new(shadow_root: PathBuf, user_root: PathBuf) -> Self { + pub fn new(user_root: PathBuf) -> Self { let user_root_canonical = fs::canonicalize(&user_root).unwrap_or_else(|_| user_root.clone()); - Self { shadow_root, user_root, user_root_canonical, source_cache: HashMap::new() } + Self { user_root, user_root_canonical, source_cache: HashMap::new() } } pub fn map_path(&self, path: &Path) -> Option { @@ -65,11 +64,6 @@ impl DiagnosticMapper { p = self.user_root.join(p); } - // Strategy A: Starts with shadow_root - if let Ok(suffix) = p.strip_prefix(&self.shadow_root) { - return Some(self.user_root.join(suffix)); - } - // Strategy B: Starts with user_root or user_root_canonical if p.starts_with(&self.user_root) || p.starts_with(&self.user_root_canonical) { return Some(p);