diff --git a/src/attribute.rs b/src/attribute.rs
index 7801575..4b131fb 100644
--- a/src/attribute.rs
+++ b/src/attribute.rs
@@ -59,35 +59,29 @@ impl<'a> Attribute<'a> {
impl fmt::Display for Attribute<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- match &self.value {
- Value::SingleLine(value) => {
- writeln!(f, "{:16}{}", format!("{}:", self.name), {
- match value {
- Some(value) => value,
- None => "",
- }
- })
+ let values = self.value.values();
+
+ let first_value = values.first().expect("must contain at least one value");
+ match first_value {
+ Some(value) => {
+ writeln!(f, "{:16}{}", format!("{}:", self.name), value)?;
}
- Value::MultiLine(values) => {
- writeln!(f, "{:16}{}", format!("{}:", self.name), {
- match &values[0] {
- Some(value) => value,
- None => "",
- }
- })?;
-
- let mut continuation_values = String::new();
- for value in &values[1..] {
- continuation_values.push_str(&format!("{:16}{}\n", "", {
- match &value {
- Some(value) => value,
- None => "",
- }
- }));
+ None => writeln!(f, "{}:", self.name)?,
+ }
+
+ let remaining_values = &values[1..];
+ for value in remaining_values {
+ match value {
+ Some(value) => {
+ writeln!(f, "{:16}{}", " ", value)?;
+ }
+ None => {
+ writeln!(f, " ")?;
}
- write!(f, "{continuation_values}")
}
}
+
+ Ok(())
}
}
@@ -265,6 +259,18 @@ impl<'a> Value<'a> {
}
}
+ fn values(&'a self) -> Vec