aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-05-10 18:32:41 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-05-10 18:32:41 +0000
commit8211cb24a543ca49b2c2b09e3654e14628300a16 (patch)
tree90c91225528043b27b98b5254e15db2eebf8870f
parentdb3606ddd8eb0c1ccd124174b25e608827a12a96 (diff)
parente6bb2e951d2ec5e973ace397bab1a2e307570570 (diff)
downloadbuild-main.tar.gz
Merge "Replace impl ToString with impl Display" into mainHEADmastermain
-rw-r--r--tools/aconfig/aflags/src/main.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/tools/aconfig/aflags/src/main.rs b/tools/aconfig/aflags/src/main.rs
index 4ce0d35ba1..516b773eaa 100644
--- a/tools/aconfig/aflags/src/main.rs
+++ b/tools/aconfig/aflags/src/main.rs
@@ -33,12 +33,12 @@ enum FlagPermission {
ReadWrite,
}
-impl ToString for FlagPermission {
- fn to_string(&self) -> String {
- match &self {
- Self::ReadOnly => "read-only".into(),
- Self::ReadWrite => "read-write".into(),
- }
+impl std::fmt::Display for FlagPermission {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", match &self {
+ Self::ReadOnly => "read-only",
+ Self::ReadWrite => "read-write",
+ })
}
}
@@ -48,12 +48,12 @@ enum ValuePickedFrom {
Server,
}
-impl ToString for ValuePickedFrom {
- fn to_string(&self) -> String {
- match &self {
- Self::Default => "default".into(),
- Self::Server => "server".into(),
- }
+impl std::fmt::Display for ValuePickedFrom {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", match &self {
+ Self::Default => "default",
+ Self::Server => "server",
+ })
}
}
@@ -75,12 +75,12 @@ impl TryFrom<&str> for FlagValue {
}
}
-impl ToString for FlagValue {
- fn to_string(&self) -> String {
- match &self {
- Self::Enabled => "enabled".into(),
- Self::Disabled => "disabled".into(),
- }
+impl std::fmt::Display for FlagValue {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", match &self {
+ Self::Enabled => "enabled",
+ Self::Disabled => "disabled",
+ })
}
}
@@ -103,7 +103,7 @@ impl Flag {
fn display_staged_value(&self) -> String {
match self.staged_value {
- Some(v) => format!("(->{})", v.to_string()),
+ Some(v) => format!("(->{})", v),
None => "-".to_string(),
}
}