@@ -493,7 +493,7 @@ impl Line {
493
493
ffi:: gpio_get_linehandle_ioctl ( self . chip . file . as_raw_fd ( ) , & mut request) ?;
494
494
Ok ( LineHandle {
495
495
line : self . clone ( ) ,
496
- flags : flags ,
496
+ flags,
497
497
file : unsafe { File :: from_raw_fd ( request. fd ) } ,
498
498
} )
499
499
}
@@ -587,14 +587,14 @@ impl LineInfo {
587
587
588
588
/// Name assigned to this chip if assigned
589
589
pub fn name ( & self ) -> Option < & str > {
590
- self . name . as_ref ( ) . map ( |s| s . as_str ( ) )
590
+ self . name . as_deref ( )
591
591
}
592
592
593
593
/// The name of this GPIO line, such as the output pin of the line on the
594
594
/// chip, a rail or a pin header name on a board, as specified by the gpio
595
595
/// chip.
596
596
pub fn consumer ( & self ) -> Option < & str > {
597
- self . consumer . as_ref ( ) . map ( |s| s . as_str ( ) )
597
+ self . consumer . as_deref ( )
598
598
}
599
599
600
600
/// Get the direction of this GPIO if configured
@@ -790,7 +790,7 @@ impl Lines {
790
790
let lines = self . lines . clone ( ) ;
791
791
Ok ( MultiLineHandle {
792
792
lines : Lines { lines } ,
793
- flags : flags ,
793
+ flags,
794
794
file : unsafe { File :: from_raw_fd ( request. fd ) } ,
795
795
} )
796
796
}
@@ -854,9 +854,7 @@ impl MultiLineHandle {
854
854
return Err ( invalid_err ( n, values. len ( ) ) ) ;
855
855
}
856
856
let mut data: ffi:: gpiohandle_data = unsafe { mem:: zeroed ( ) } ;
857
- for i in 0 ..n {
858
- data. values [ i] = values[ i] ;
859
- }
857
+ data. values [ ..n] . clone_from_slice ( & values[ ..n] ) ;
860
858
ffi:: gpiohandle_set_line_values_ioctl ( self . file . as_raw_fd ( ) , & mut data) ?;
861
859
Ok ( ( ) )
862
860
}
0 commit comments