diff --git a/bin/src/control.rs b/bin/src/control.rs index 8c1f51d..0c5adbc 100644 --- a/bin/src/control.rs +++ b/bin/src/control.rs @@ -1,4 +1,7 @@ -use std::{error::Error, fmt}; +use std::{ + error::Error, + fmt::{self, Display}, +}; use matching::matching_configuration; use parsing::ParserConfiguration; @@ -30,11 +33,11 @@ pub enum ExecutionResult { WithoutConflicts(String), } -impl ToString for ExecutionResult { - fn to_string(&self) -> String { +impl Display for ExecutionResult { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - ExecutionResult::WithConflicts(value) => value.to_owned(), - ExecutionResult::WithoutConflicts(value) => value.to_owned(), + ExecutionResult::WithConflicts(value) => write!(f, "{}", value), + ExecutionResult::WithoutConflicts(value) => write!(f, "{}", value), } } } diff --git a/merge/src/merged_cst_node.rs b/merge/src/merged_cst_node.rs index 20112ac..8778415 100644 --- a/merge/src/merged_cst_node.rs +++ b/merge/src/merged_cst_node.rs @@ -62,12 +62,9 @@ impl Display for MergedCSTNode<'_> { write!(f, "{}", result) } MergedCSTNode::Conflict { left, right } => match (left, right) { - (Some(left), Some(right)) => write!( - f, - "<<<<<<<<< {} ========= {} >>>>>>>>>", - left, - right - ), + (Some(left), Some(right)) => { + write!(f, "<<<<<<<<< {} ========= {} >>>>>>>>>", left, right) + } (Some(left), None) => { write!(f, "<<<<<<<<< {} ========= >>>>>>>>>", left) }