From 116cbddf7a8dd70123257da48751dc0ec8f495f3 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 2 Nov 2019 18:24:24 +0100 Subject: [PATCH] system: implement Display --- ofborg/src/commentparser.rs | 1 - ofborg/src/outpathdiff.rs | 1 - ofborg/src/systems.rs | 12 +++++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ofborg/src/commentparser.rs b/ofborg/src/commentparser.rs index ea098e6..f7b8896 100644 --- a/ofborg/src/commentparser.rs +++ b/ofborg/src/commentparser.rs @@ -244,5 +244,4 @@ baz", parse("@ofborg build foo bar baz.Baz") ); } - } diff --git a/ofborg/src/outpathdiff.rs b/ofborg/src/outpathdiff.rs index b1f79af..668367c 100644 --- a/ofborg/src/outpathdiff.rs +++ b/ofborg/src/outpathdiff.rs @@ -191,5 +191,4 @@ gnome3.evolution_data_server.aarch64-linux /nix/ ); assert_eq!(parse_lines(&mut Cursor::new(TEST_LINES)), expect); } - } diff --git a/ofborg/src/systems.rs b/ofborg/src/systems.rs index 140f1bc..f296270 100644 --- a/ofborg/src/systems.rs +++ b/ofborg/src/systems.rs @@ -5,15 +5,17 @@ pub enum System { X8664Darwin, } -impl System { - pub fn to_string(&self) -> String { +impl std::fmt::Display for System { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - System::X8664Linux => String::from("x86_64-linux"), - System::Aarch64Linux => String::from("aarch64-linux"), - System::X8664Darwin => String::from("x86_64-darwin"), + System::X8664Linux => write!(f, "x86_64-linux"), + System::Aarch64Linux => write!(f, "aarch64-linux"), + System::X8664Darwin => write!(f, "x86_64-darwin"), } } +} +impl System { pub fn as_build_destination(&self) -> (Option, Option) { (None, Some(format!("build-inputs-{}", self.to_string()))) }