diff options
Diffstat (limited to 'src/errors')
-rw-r--r-- | src/errors/merge_error.rs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/errors/merge_error.rs b/src/errors/merge_error.rs index a694b71..3ff60d2 100644 --- a/src/errors/merge_error.rs +++ b/src/errors/merge_error.rs @@ -14,27 +14,25 @@ impl MergeError<'_> { pub fn report(&self) { error!("A cyclic dependency was found between the following libraries:"); for id in &self.cyclic_unit_ids { - if let Some(unit) = self.resolver.source_units.get(*id) { - let path = &unit.source_unit.path(); - match unit.source_unit.name() { - Some(name) => - eprintln!("{name}{NORMAL}{DIM} ({path}){NORMAL}"), + let unit = &self.resolver.source_units[*id]; + let path = &unit.source_unit.path(); + match unit.source_unit.name() { + Some(name) => + eprintln!("{name}{NORMAL}{DIM} ({path}){NORMAL}"), + None => + eprintln!("{path}"), + }; + // Print each parent involved in the dependency cycle. + for parent_id in &unit.parent_ids { + if !self.cyclic_unit_ids.contains(parent_id) { continue; } + let parent_unit = &self.resolver.source_units[*parent_id]; + let parent_path = &parent_unit.source_unit.path(); + match parent_unit.source_unit.name() { + Some(parent_name) => + eprintln!(" => {parent_name} {DIM}({parent_path}){NORMAL}"), None => - eprintln!("{path}"), + eprintln!(" => {parent_path}"), }; - // Print each parent involved in the dependency cycle. - for parent_id in &unit.parent_ids { - if !self.cyclic_unit_ids.contains(parent_id) { continue; } - if let Some(parent_unit) = self.resolver.source_units.get(*parent_id) { - let parent_path = &parent_unit.source_unit.path(); - match parent_unit.source_unit.name() { - Some(parent_name) => - eprintln!(" => {parent_name} {DIM}({parent_path}){NORMAL}"), - None => - eprintln!(" => {parent_path}"), - }; - } - } } } } |