@@ -84,12 +84,10 @@ impl From<toml::DecodeError> for Error {
84
84
impl Decodable for GpioConfig {
85
85
fn decode < D : Decoder > ( d : & mut D ) -> Result < Self , D :: Error > {
86
86
// Get items under the [config] header if present
87
- let symlink_root: Option < String > = d. read_struct_field ( "config" , 0 , |cfg| {
88
- cfg. read_struct_field ( "symlink_root" ,
89
- 0 ,
90
- Decodable :: decode)
91
- } )
92
- . ok ( ) ;
87
+ let symlink_root = d. read_struct_field ( "config" , 0 , |cfg| {
88
+ cfg. read_struct_field ( "symlink_root" , 0 , Decodable :: decode)
89
+ } )
90
+ . ok ( ) ;
93
91
94
92
Ok ( GpioConfig {
95
93
pins : try!( d. read_struct_field ( "pins" , 0 , Decodable :: decode) ) ,
@@ -120,7 +118,6 @@ impl Decodable for PinConfig {
120
118
}
121
119
122
120
impl PinConfig {
123
-
124
121
/// Get the `sysfs_gpio::Pin` to go along with this config`
125
122
pub fn get_pin ( & self ) -> sysfs_gpio:: Pin {
126
123
sysfs_gpio:: Pin :: new ( self . num )
@@ -204,7 +201,7 @@ impl GpioConfig {
204
201
Ok ( cfg) => {
205
202
try!( cfg. validate ( ) . or_else ( |e| Err ( Error :: from ( e) ) ) ) ;
206
203
Ok ( cfg)
207
- } ,
204
+ }
208
205
Err ( e) => Err ( Error :: from ( e) ) ,
209
206
}
210
207
}
@@ -223,7 +220,7 @@ impl GpioConfig {
223
220
pub fn get_pin ( & self , name : & str ) -> Option < & PinConfig > {
224
221
// first, try to find pin by name
225
222
if let Some ( pin) = self . pins . iter ( ) . find ( |p| p. names . contains ( name) ) {
226
- return Some ( pin)
223
+ return Some ( pin) ;
227
224
}
228
225
229
226
// Try to parse the name as a 64-bit integer and match against that
0 commit comments