@@ -125,7 +125,7 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
125125 debug ! ( r#"Type "{}" not found, outputting anyway"# , elem. type_( ) ) ;
126126 & trimmed_type
127127 } ) ;
128- let ( type_, bits ) = if let Some ( ref o) = elem. occurs ( ) {
128+ let ( type_, _bits ) = if let Some ( ref o) = elem. occurs ( ) {
129129 use :: flat_ast:: Occurs :: * ;
130130 let type_ = match o {
131131 Unbounded => format ! ( "Vec" ) ,
@@ -211,7 +211,7 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
211211 cg ! ( self , "union {}InternalData {{" , complex. name( ) ) ;
212212 self . indent ( ) ;
213213 for elem in c. elements ( ) {
214- if let Some ( ref seq ) = c. inline_seqs ( ) . get ( elem. name ( ) ) {
214+ if let Some ( ref _seq ) = c. inline_seqs ( ) . get ( elem. name ( ) ) {
215215 cg ! ( self , "{}: {}," , elem. name( ) . to_snake_case( ) , elem. name( ) ) ;
216216 } else {
217217 self . element ( elem, & iserialize) ?;
@@ -233,22 +233,22 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
233233 self . element ( elem, & iserialize) ?;
234234 }
235235 } ,
236- Choice ( ref c ) => {
236+ Choice ( ref _c ) => {
237237 cg ! ( self , "data: {}InternalData," , complex. name( ) ) ;
238238 } ,
239239 Empty => { }
240240 }
241241 self . dedent ( ) ;
242242 cg ! ( self , "}}" ) ;
243243 cg ! ( self ) ;
244- self . complex_encode ( complex, iserialize) ;
244+ let _ = self . complex_encode ( complex, iserialize) ;
245245 cg ! ( self ) ;
246- self . complex_decode ( complex, iserialize) ;
246+ let _ = self . complex_decode ( complex, iserialize) ;
247247 }
248248 Ok ( ( ) )
249249 }
250250
251- fn complex_encode ( & mut self , complex : & ComplexType , iserialize : & HashMap < String , String > ) -> Result < ( ) > {
251+ fn complex_encode ( & mut self , complex : & ComplexType , _iserialize : & HashMap < String , String > ) -> Result < ( ) > {
252252 use :: flat_ast:: ComplexTypeContent :: * ;
253253 cg ! ( self , "impl Encode for {} {{" , complex. name( ) ) ;
254254 self . indent ( ) ;
@@ -262,7 +262,7 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
262262 cg ! ( self , "self.{}.encode(encoder)?;" , data) ;
263263 }
264264 } ,
265- Choice ( ref c ) => {
265+ Choice ( ref _c ) => {
266266 // TODO: Figure out how to make this work
267267 } ,
268268 Empty => { }
@@ -298,7 +298,7 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
298298 output_list. push ( name) ;
299299 }
300300 } ,
301- Choice ( ref c ) => {
301+ Choice ( ref _c ) => {
302302 // TODO: Figure out how to make this work
303303 } ,
304304 Empty => { }
@@ -418,20 +418,20 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
418418 Ok ( ( ) )
419419 }
420420
421- fn restrict_encode ( & mut self , restrict : & Restriction , name : & str , iserialize : & HashMap < String , String > ) -> Result < ( ) > {
421+ fn restrict_encode ( & mut self , restrict : & Restriction , name : & str , _iserialize : & HashMap < String , String > ) -> Result < ( ) > {
422422 let is_enum = restrict. contents ( ) . iter ( ) . find ( |content| match content {
423423 Enumeration ( _) => true ,
424424 _ => false
425425 } ) . is_some ( ) ;
426- let trimmed_type = restrict. base ( ) . trim ( ) . to_string ( ) ;
427- let mut rust_type = iserialize. get ( restrict. base ( ) . trim ( ) ) . map ( |s| s. to_string ( ) ) . unwrap_or_else ( || {
428- debug ! ( r#"Type "{}" not found, outputting anyway"# , restrict. base( ) ) ;
429- trimmed_type. clone ( )
430- } ) ;
431-
432- if "NullTerminatedString" == rust_type {
433- rust_type = "String" . to_string ( ) ;
434- }
426+ // let trimmed_type = restrict.base().trim().to_string();
427+ // let mut rust_type = iserialize.get(restrict.base().trim()).map(|s| s.to_string()).unwrap_or_else(|| {
428+ // debug!(r#"Type "{}" not found, outputting anyway"#, restrict.base());
429+ // trimmed_type.clone()
430+ // });
431+ //
432+ // if "NullTerminatedString" == rust_type {
433+ // rust_type = "String".to_string();
434+ // }
435435
436436 cg ! ( self , "impl Encode for {} {{" , name. to_upper_camel_case( ) ) ;
437437 self . indent ( ) ;
@@ -456,10 +456,10 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
456456 cg ! ( self , "encoder.writer().write(&vec![0; fixed_length - bytes.len()])?;" ) ;
457457 cg ! ( self , "Ok(())" ) ;
458458 } ,
459- MinValue ( v ) => {
459+ MinValue ( _v ) => {
460460
461461 } ,
462- MaxValue ( v ) => {
462+ MaxValue ( _v ) => {
463463
464464 } ,
465465 _ => panic ! ( "enumeration in restrict when there shouldn't be one" )
@@ -508,18 +508,18 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
508508 } else {
509509 let data = name. to_string ( ) . to_snake_case ( ) ;
510510 let mut fixed_length = 64 ;
511- let mut minValueCheck = String :: new ( ) ;
512- let mut maxValueCheck = String :: new ( ) ;
511+ let mut min_value_check = String :: new ( ) ;
512+ let mut max_value_check = String :: new ( ) ;
513513 for content in restrict. contents ( ) {
514514 match content {
515515 Length ( l) => {
516516 fixed_length = * l;
517517 } ,
518518 MinValue ( v) => {
519- minValueCheck = format ! ( "if {} < {} {{Err(bincode::error::DecodeError::OtherString(format!(\" Invalid value for {}: {{}} < {{}}\" , {}, {})))}}" , data, v, data, data, v) . into ( ) ;
519+ min_value_check = format ! ( "if {} < {} {{Err(bincode::error::DecodeError::OtherString(format!(\" Invalid value for {}: {{}} < {{}}\" , {}, {})))}}" , data, v, data, data, v) . into ( ) ;
520520 } ,
521521 MaxValue ( v) => {
522- maxValueCheck = format ! ( "if {} > {} {{Err(bincode::error::DecodeError::OtherString(format!(\" Invalid value for {}: {{}} > {{}}\" , {}, {})))}}" , data, v, data, data, v) . into ( ) ;
522+ max_value_check = format ! ( "if {} > {} {{Err(bincode::error::DecodeError::OtherString(format!(\" Invalid value for {}: {{}} > {{}}\" , {}, {})))}}" , data, v, data, data, v) . into ( ) ;
523523 } ,
524524 _ => panic ! ( "enumeration in restrict when there shouldn't be one" )
525525 }
@@ -535,9 +535,9 @@ impl<'a, W: Write> CodeSourceGenerator<'a, W> {
535535 } else {
536536 cg ! ( self , "let {} = {}::decode(buffer)?;" , data, rust_type) ;
537537
538- cg ! ( self , "{}" , minValueCheck ) ;
538+ cg ! ( self , "{}" , min_value_check ) ;
539539
540- cg ! ( self , "{}" , maxValueCheck ) ;
540+ cg ! ( self , "{}" , max_value_check ) ;
541541 }
542542 cg ! ( self , "Ok(Self {{ {} }})" , data) ;
543543 }
0 commit comments