From b706de7a9569f182d022b097f8eb42677815808a Mon Sep 17 00:00:00 2001 From: philippeitis <33013301+philippeitis@users.noreply.github.com> Date: Wed, 19 Oct 2022 20:47:19 -0700 Subject: [PATCH] Add default impl to InvalidOptionsError --- google-clis-common/src/lib.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/google-clis-common/src/lib.rs b/google-clis-common/src/lib.rs index 2bdb12a627..36ebec625a 100644 --- a/google-clis-common/src/lib.rs +++ b/google-clis-common/src/lib.rs @@ -620,6 +620,15 @@ pub struct InvalidOptionsError { pub exit_code: i32, } +impl Default for InvalidOptionsError { + fn default() -> Self { + InvalidOptionsError { + issues: Vec::new(), + exit_code: 1, + } + } +} + impl fmt::Display for InvalidOptionsError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { for issue in &self.issues { @@ -638,10 +647,7 @@ impl InvalidOptionsError { } pub fn new() -> InvalidOptionsError { - InvalidOptionsError { - issues: Vec::new(), - exit_code: 1, - } + Default::default() } }