@@ -493,7 +493,7 @@ impl Line {
493493 ffi:: gpio_get_linehandle_ioctl ( self . chip . file . as_raw_fd ( ) , & mut request) ?;
494494 Ok ( LineHandle {
495495 line : self . clone ( ) ,
496- flags : flags ,
496+ flags,
497497 file : unsafe { File :: from_raw_fd ( request. fd ) } ,
498498 } )
499499 }
@@ -587,14 +587,14 @@ impl LineInfo {
587587
588588 /// Name assigned to this chip if assigned
589589 pub fn name ( & self ) -> Option < & str > {
590- self . name . as_ref ( ) . map ( |s| s . as_str ( ) )
590+ self . name . as_deref ( )
591591 }
592592
593593 /// The name of this GPIO line, such as the output pin of the line on the
594594 /// chip, a rail or a pin header name on a board, as specified by the gpio
595595 /// chip.
596596 pub fn consumer ( & self ) -> Option < & str > {
597- self . consumer . as_ref ( ) . map ( |s| s . as_str ( ) )
597+ self . consumer . as_deref ( )
598598 }
599599
600600 /// Get the direction of this GPIO if configured
@@ -790,7 +790,7 @@ impl Lines {
790790 let lines = self . lines . clone ( ) ;
791791 Ok ( MultiLineHandle {
792792 lines : Lines { lines } ,
793- flags : flags ,
793+ flags,
794794 file : unsafe { File :: from_raw_fd ( request. fd ) } ,
795795 } )
796796 }
@@ -854,9 +854,7 @@ impl MultiLineHandle {
854854 return Err ( invalid_err ( n, values. len ( ) ) ) ;
855855 }
856856 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] ) ;
860858 ffi:: gpiohandle_set_line_values_ioctl ( self . file . as_raw_fd ( ) , & mut data) ?;
861859 Ok ( ( ) )
862860 }
0 commit comments