@@ -6,7 +6,6 @@ mod kernlog;
66mod setup;
77
88use anyhow:: Result ;
9- use indoc:: indoc;
109use log:: { info, LevelFilter } ;
1110use std:: borrow:: Cow ;
1211use std:: env;
@@ -25,11 +24,11 @@ enum Opts {
2524#[ rustfmt:: skip]
2625fn command ( ) -> clap:: Command {
2726 clap:: command!( )
28- . override_usage ( indoc ! { "
29- zram -generator --setup-device <device>
30- zram -generator --reset-device <device>
31- zram -generator dir1 [dir2 dir3]
32- " } )
27+ . override_usage ( " \
28+ \t zram -generator --setup-device <device>\n \
29+ \t zram -generator --reset-device <device>\n \
30+ \t zram -generator dir1 [dir2 dir3]\
31+ ")
3332 . arg (
3433 clap:: arg!( --"setup-device" <device> "Set up a single device" )
3534 . conflicts_with ( "reset-device" )
@@ -50,13 +49,13 @@ fn command() -> clap::Command {
5049fn get_opts ( ) -> Opts {
5150 let opts = command ( ) . get_matches ( ) ;
5251
53- if let Some ( val) = opts. get_one :: < String > ( "setup-device" ) {
54- Opts :: SetupDevice ( val. clone ( ) )
55- } else if let Some ( val) = opts. get_one :: < String > ( "reset-device" ) {
56- Opts :: ResetDevice ( val. clone ( ) )
52+ if let Some ( val) = opts. get_one :: < & str > ( "setup-device" ) {
53+ Opts :: SetupDevice ( val. to_string ( ) )
54+ } else if let Some ( val) = opts. get_one :: < & str > ( "reset-device" ) {
55+ Opts :: ResetDevice ( val. to_string ( ) )
5756 } else {
58- let val = opts. get_one :: < String > ( "dir" ) . expect ( "clap invariant" ) ;
59- Opts :: GenerateUnits ( val. clone ( ) )
57+ let val = opts. get_one :: < & str > ( "dir" ) . expect ( "clap invariant" ) ;
58+ Opts :: GenerateUnits ( val. to_string ( ) )
6059 }
6160}
6261
0 commit comments