@@ -89,55 +89,55 @@ fn _main() -> Result<(), Box<dyn Error>> {
8989 Duration :: from_millis ( 5000 ) ,
9090 ) ;
9191
92- Ok ( match Cli :: parse ( ) {
92+ match Cli :: parse ( ) {
9393 Cli :: Color {
9494 color,
9595 sector : Some ( sector) ,
9696 } => {
97- devices. method_call (
97+ let _ : ( ) = devices. method_call (
9898 "de.richardliebscher.gdevd.GDeviceManager" ,
9999 "color_sector" ,
100100 ( & color as & str , sector) ,
101- ) ?
101+ ) ?;
102102 }
103103 Cli :: Color { color, sector : _ } => {
104- devices. method_call (
104+ let _ : ( ) = devices. method_call (
105105 "de.richardliebscher.gdevd.GDeviceManager" ,
106106 "color_sectors" ,
107107 ( & color as & str , ) ,
108- ) ?
108+ ) ?;
109109 }
110110 Cli :: Breathe {
111111 color,
112112 time_step,
113113 brightness,
114114 } => {
115- devices. method_call (
115+ let _ : ( ) = devices. method_call (
116116 "de.richardliebscher.gdevd.GDeviceManager" ,
117117 "breathe" ,
118118 ( color, time_step, brightness) ,
119- ) ?
119+ ) ?;
120120 }
121121 Cli :: Cycle {
122122 time_step,
123123 brightness,
124124 } => {
125- devices. method_call (
125+ let _ : ( ) = devices. method_call (
126126 "de.richardliebscher.gdevd.GDeviceManager" ,
127127 "cycle" ,
128128 ( time_step, brightness) ,
129- ) ?
129+ ) ?;
130130 }
131131 Cli :: Wave {
132132 direction,
133133 time_step,
134134 brightness,
135135 } => {
136- devices. method_call (
136+ let _ : ( ) = devices. method_call (
137137 "de.richardliebscher.gdevd.GDeviceManager" ,
138138 "wave" ,
139139 ( & direction as & str , time_step, brightness) ,
140- ) ?
140+ ) ?;
141141 }
142142 Cli :: Refresh => {
143143 devices. method_call ( "de.richardliebscher.gdevd.GDeviceManager" , "refresh" , ( ) ) ?
@@ -161,7 +161,9 @@ fn _main() -> Result<(), Box<dyn Error>> {
161161 }
162162 Cli :: InstallService { prefix } => install_service ( & prefix) ?,
163163 Cli :: UninstallService { prefix } => uninstall_service ( & prefix) ?,
164- } )
164+ } ;
165+
166+ Ok ( ( ) )
165167}
166168
167169static SERVICE_FILES : & [ ( & str , & str ) ] = & [
@@ -193,7 +195,7 @@ fn install_service(prefix: &Path) -> Result<(), io::Error> {
193195
194196 let prefix_str = prefix
195197 . to_str ( )
196- . ok_or_else ( || io:: Error :: new ( io :: ErrorKind :: Other , "invalid prefix path" ) ) ?;
198+ . ok_or_else ( || io:: Error :: other ( "invalid prefix path" ) ) ?;
197199
198200 for ( path, content) in SERVICE_FILES {
199201 install_file ( path, content. replace ( "$$PREFIX$$" , prefix_str) . as_bytes ( ) ) ?;
@@ -244,8 +246,8 @@ fn uninstall_service(prefix: &Path) -> Result<(), io::Error> {
244246 run_command ( Command :: new ( "systemctl" ) . arg ( "stop" ) . arg ( "gdevd" ) )
245247 } ) ?;
246248
247- uninstall_file ( & prefix. join ( "bin/gdevd" ) ) ?;
248- uninstall_file ( & prefix. join ( "bin/gdevctl" ) ) ?;
249+ uninstall_file ( prefix. join ( "bin/gdevd" ) ) ?;
250+ uninstall_file ( prefix. join ( "bin/gdevctl" ) ) ?;
249251
250252 for ( path, _) in SERVICE_FILES {
251253 uninstall_file ( path) ?;
@@ -268,10 +270,7 @@ fn uninstall_file(path: impl AsRef<Path>) -> Result<(), io::Error> {
268270fn run_command ( cmd : & mut Command ) -> io:: Result < ( ) > {
269271 let out = cmd. output ( ) ?;
270272 if !out. status . success ( ) {
271- Err ( io:: Error :: new (
272- io:: ErrorKind :: Other ,
273- String :: from_utf8_lossy ( & out. stderr ) ,
274- ) )
273+ Err ( io:: Error :: other ( String :: from_utf8_lossy ( & out. stderr ) ) )
275274 } else {
276275 Ok ( ( ) )
277276 }
0 commit comments