diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-02 17:30:21 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-02 17:30:21 +0200 |
commit | f35b3d29d8ed521f69522aa0fda594f277c72b5c (patch) | |
tree | 341a61ff1e0e8e528197c30edee9e4745df65a27 /macros/src/injectable_impl.rs | |
parent | c6aa8be159b83ceb74472f95490f78cf72b74cc9 (diff) |
refactor: move creating a dependency trace to it's own function
Diffstat (limited to 'macros/src/injectable_impl.rs')
-rw-r--r-- | macros/src/injectable_impl.rs | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/macros/src/injectable_impl.rs b/macros/src/injectable_impl.rs index b24749c..3bd7113 100644 --- a/macros/src/injectable_impl.rs +++ b/macros/src/injectable_impl.rs @@ -86,26 +86,15 @@ impl InjectableImpl if dependency_history.contains(&self_type_name) { dependency_history.push(self_type_name); - let dependency_trace = dependency_history - .iter() - .map(|dep| { - if dep == &self_type_name { - format!("\x1b[1m{}\x1b[22m", dep) - } else { - dep.to_string() - } - }) - .collect::<Vec<_>>() - .join(" -> "); - return Err( report!(ResolveError) - .attach_printable( - format!( - "Detected circular dependencies. {}", - dependency_trace.clone(), + .attach_printable(format!( + "Detected circular dependencies. {}", + syrette::dependency_trace::create_dependency_trace( + dependency_history.as_slice(), + self_type_name ) - ) + )) ); } |