aboutsummaryrefslogtreecommitdiff
path: root/src/dependency_trace.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-02 17:30:21 +0200
committerHampusM <hampus@hampusmat.com>2022-08-02 17:30:21 +0200
commitf35b3d29d8ed521f69522aa0fda594f277c72b5c (patch)
tree341a61ff1e0e8e528197c30edee9e4745df65a27 /src/dependency_trace.rs
parentc6aa8be159b83ceb74472f95490f78cf72b74cc9 (diff)
refactor: move creating a dependency trace to it's own function
Diffstat (limited to 'src/dependency_trace.rs')
-rw-r--r--src/dependency_trace.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/dependency_trace.rs b/src/dependency_trace.rs
new file mode 100644
index 0000000..d46b762
--- /dev/null
+++ b/src/dependency_trace.rs
@@ -0,0 +1,20 @@
+#![allow(clippy::module_name_repetitions)]
+
+#[must_use]
+pub fn create_dependency_trace(
+ dependency_history: &[&'static str],
+ err_dependency: &'static str,
+) -> String
+{
+ dependency_history
+ .iter()
+ .map(|dep| {
+ if dep == &err_dependency {
+ format!("\x1b[1m{}\x1b[22m", dep)
+ } else {
+ (*dep).to_string()
+ }
+ })
+ .collect::<Vec<_>>()
+ .join(" -> ")
+}