File tree Expand file tree Collapse file tree 4 files changed +11
-13
lines changed
Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ impl SubcommandExecutor for AddArgs {
8080
8181fn get_from_args ( matches : AddArgs ) -> color_eyre:: Result < OTPElement > {
8282 let secret = rpassword:: prompt_password ( "Insert the secret: " ) . map_err ( ErrReport :: from) ?;
83- map_args_to_code ( secret, matches) . map_err ( ErrReport :: from )
83+ map_args_to_code ( secret, matches)
8484}
8585
8686fn map_args_to_code ( secret : String , matches : AddArgs ) -> Result < OTPElement > {
Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ impl SubcommandExecutor for ExtractArgs {
4848}
4949
5050fn filter_extract ( args : & ExtractArgs , index : usize , code : & OTPElement ) -> bool {
51- let match_by_index = args. index . map_or ( true , |i| i == index) ;
51+ let match_by_index = args. index . is_none_or ( |i| i == index) ;
5252
53- let match_by_issuer = args. issuer . as_ref ( ) . map_or ( true , |issuer| {
54- code. issuer . to_lowercase ( ) == issuer. to_lowercase ( )
55- } ) ;
53+ let match_by_issuer = args
54+ . issuer
55+ . as_ref ( )
56+ . is_none_or ( |issuer| code. issuer . to_lowercase ( ) == issuer. to_lowercase ( ) ) ;
5657
57- let match_by_label = args. label . as_ref ( ) . map_or ( true , |label| {
58- code. label . to_lowercase ( ) == label. to_lowercase ( )
59- } ) ;
58+ let match_by_label = args
59+ . label
60+ . as_ref ( )
61+ . is_none_or ( |label| code. label . to_lowercase ( ) == label. to_lowercase ( ) ) ;
6062
6163 match_by_index && match_by_issuer && match_by_label
6264}
Original file line number Diff line number Diff line change 11use clap:: Args ;
2- use color_eyre:: eyre:: ErrReport ;
32use zeroize:: Zeroize ;
43
54use crate :: { otp:: otp_element:: OTPDatabase , utils} ;
@@ -12,9 +11,7 @@ pub struct PasswdArgs;
1211impl SubcommandExecutor for PasswdArgs {
1312 fn run_command ( self , mut database : OTPDatabase ) -> color_eyre:: Result < OTPDatabase > {
1413 let mut new_password = utils:: verified_password ( "New password: " , 8 ) ;
15- database
16- . save_with_pw ( & new_password)
17- . map_err ( ErrReport :: from) ?;
14+ database. save_with_pw ( & new_password) ?;
1815 new_password. zeroize ( ) ;
1916 Ok ( database)
2017 }
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ fn get_default_db_path() -> PathBuf {
3636 let home_path = home_dir ( ) . map ( |path| path. join ( HOME_PATH ) ) ;
3737
3838 data_dir ( )
39- . map ( PathBuf :: from)
4039 . map ( |p| p. join ( XDG_PATH ) )
4140 . inspect ( |xdg| {
4241 if !xdg. exists ( ) {
You can’t perform that action at this time.
0 commit comments