From 5bae3eaa749db5b7dfc62bf189938fda0e0049c0 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 7 Sep 2024 09:47:53 +0900 Subject: [PATCH] cli: remove unneeded Display for SparseInheritance Since it's a ValueEnum, clap knows how to stringify the default value. --- cli/src/commands/workspace/add.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/cli/src/commands/workspace/add.rs b/cli/src/commands/workspace/add.rs index 92f347d45..8cd640b09 100644 --- a/cli/src/commands/workspace/add.rs +++ b/cli/src/commands/workspace/add.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fmt::Display; use std::fs; use itertools::Itertools; @@ -43,16 +42,6 @@ enum SparseInheritance { Empty, } -impl Display for SparseInheritance { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - SparseInheritance::Copy => write!(f, "copy"), - SparseInheritance::Full => write!(f, "full"), - SparseInheritance::Empty => write!(f, "empty"), - } - } -} - /// Add a workspace /// /// By default, the new workspace inherits the sparse patterns of the current @@ -82,7 +71,7 @@ pub struct WorkspaceAddArgs { #[arg(long, short)] revision: Vec, /// How to handle sparse patterns when creating a new workspace. - #[arg(long, default_value_t=SparseInheritance::Copy)] + #[arg(long, value_enum, default_value_t = SparseInheritance::Copy)] sparse_patterns: SparseInheritance, }