core/formats: implement ToString instead of Display for NAChannelType
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 6 Jul 2020 16:34:39 +0000 (18:34 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 6 Jul 2020 16:34:39 +0000 (18:34 +0200)
nihav-core/src/formats.rs

index d2f1c25db5e024867bc29a8fdf577836c7bc0bd4..4c577cf2f3803d747d7ef6c951cc1539de98e520 100644 (file)
@@ -220,9 +220,9 @@ impl FromStr for NAChannelType {
     }
 }
 
-impl fmt::Display for NAChannelType {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        let name = match *self {
+impl ToString for NAChannelType {
+    fn to_string(&self) -> String {
+        match *self {
             NAChannelType::C    => "C".to_string(),
             NAChannelType::L    => "L".to_string(),
             NAChannelType::R    => "R".to_string(),
@@ -251,8 +251,7 @@ impl fmt::Display for NAChannelType {
             NAChannelType::Rt   => "Rt".to_string(),
             NAChannelType::Lo   => "Lo".to_string(),
             NAChannelType::Ro   => "Ro".to_string(),
-        };
-        write!(f, "{}", name)
+        }
     }
 }