diff --git a/wsdl-parser/src/parser/port_type.rs b/wsdl-parser/src/parser/port_type.rs index b3998644..2dc1126b 100644 --- a/wsdl-parser/src/parser/port_type.rs +++ b/wsdl-parser/src/parser/port_type.rs @@ -147,8 +147,8 @@ impl<'a> OperationType<'a> { assert_eq!( output_node.wsdl_type(), ElementType::Output, - "{}", - format!("{:?}", output_node) + "{:?}", + output_node ); OperationType::RequestResponse { input: Param::new(&ch), diff --git a/xsd-parser/src/parser/union.rs b/xsd-parser/src/parser/union.rs index 55dff7a8..1d40f448 100644 --- a/xsd-parser/src/parser/union.rs +++ b/xsd-parser/src/parser/union.rs @@ -12,7 +12,7 @@ use std::cell::RefCell; pub fn parse_union(union: &Node) -> RsEntity { let mut cases = union .attribute(attribute::MEMBER_TYPES) - .map(|s| create_enum_cases(s)) + .map(create_enum_cases) .unwrap_or_else(Vec::new); let subtypes = union diff --git a/xsd-types/src/types/decimal.rs b/xsd-types/src/types/decimal.rs index 06764421..2951b45c 100644 --- a/xsd-types/src/types/decimal.rs +++ b/xsd-types/src/types/decimal.rs @@ -26,7 +26,7 @@ impl FromStr for Decimal { impl fmt::Display for Decimal { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0.to_string()) + write!(f, "{}", self.0) } } diff --git a/xsd-types/src/types/duration.rs b/xsd-types/src/types/duration.rs index ed77bfd0..575807f7 100644 --- a/xsd-types/src/types/duration.rs +++ b/xsd-types/src/types/duration.rs @@ -1,4 +1,5 @@ use std::fmt; +use std::fmt::Write; use std::str::FromStr; use xsd_macro_utils::UtilsDefaultSerde; @@ -166,7 +167,7 @@ impl FromStr for Duration { context.is_dot_found = true; } digit => { - if !digit.is_digit(10) { + if !digit.is_ascii_digit() { return Err("Incorrect character occurred".into()); } @@ -215,24 +216,24 @@ impl fmt::Display for Duration { let mut date_str = String::new(); if self.years > 0 { - date_str.push_str(&format!("{}Y", self.years)); + write!(&mut date_str, "{}Y", self.years)?; } if self.months > 0 { - date_str.push_str(&format!("{}M", self.months)); + write!(&mut date_str, "{}M", self.months)?; } if self.days > 0 { - date_str.push_str(&format!("{}D", self.days)); + write!(&mut date_str, "{}D", self.days)?; } let mut time_str = String::new(); if self.hours > 0 { - time_str.push_str(&format!("{}H", self.hours)); + write!(&mut time_str, "{}H", self.hours)?; } if self.minutes > 0 { - time_str.push_str(&format!("{}M", self.minutes)); + write!(&mut time_str, "{}M", self.minutes)?; } if self.seconds > 0.0 { - time_str.push_str(&format!("{}S", self.seconds)); + write!(&mut time_str, "{}S", self.seconds)?; } if time_str.is_empty() { diff --git a/xsd-types/src/types/gday.rs b/xsd-types/src/types/gday.rs index 928e4c57..be23d716 100644 --- a/xsd-types/src/types/gday.rs +++ b/xsd-types/src/types/gday.rs @@ -41,7 +41,7 @@ impl FromStr for GDay { return Err("bad gDay format".to_string()); } let token = &s[3..5]; - if !token.chars().all(|c| c.is_digit(10)) { + if !token.chars().all(|c| c.is_ascii_digit()) { return Err("bad gDay format".to_string()); } token.parse::().map_err(|e| e.to_string()) diff --git a/xsd-types/src/types/gmonth.rs b/xsd-types/src/types/gmonth.rs index 8484531e..fedca307 100644 --- a/xsd-types/src/types/gmonth.rs +++ b/xsd-types/src/types/gmonth.rs @@ -41,7 +41,7 @@ impl FromStr for GMonth { return Err("bad gMonth format".to_string()); } let token = &s[2..4]; - if !token.chars().all(|c| c.is_digit(10)) { + if !token.chars().all(|c| c.is_ascii_digit()) { return Err("bad gMonth format".to_string()); } token.parse::().map_err(|e| e.to_string()) diff --git a/xsd-types/src/types/gmonthday.rs b/xsd-types/src/types/gmonthday.rs index 72253eda..37ef525c 100644 --- a/xsd-types/src/types/gmonthday.rs +++ b/xsd-types/src/types/gmonthday.rs @@ -71,13 +71,13 @@ impl FromStr for GMonthDay { } let month_token = &s[2..4]; - if !month_token.chars().all(|c| c.is_digit(10)) { + if !month_token.chars().all(|c| c.is_ascii_digit()) { return Err("bad month format within gMonthDay".to_string()); } let month = month_token.parse::().map_err(|e| e.to_string())?; let day_token = &s[5..7]; - if !day_token.chars().all(|c| c.is_digit(10)) { + if !day_token.chars().all(|c| c.is_ascii_digit()) { return Err("bad day format within gMonthDay".to_string()); } let day = day_token.parse::().map_err(|e| e.to_string())?; diff --git a/xsd-types/src/types/gyear.rs b/xsd-types/src/types/gyear.rs index b6296212..8e2d8596 100644 --- a/xsd-types/src/types/gyear.rs +++ b/xsd-types/src/types/gyear.rs @@ -53,7 +53,7 @@ fn parse_str_positive(s: &str) -> Result { if s.len() < 4 { return Err("bad gYear format: to short".to_string()); } - if !s.chars().all(|c| c.is_digit(10)) { + if !s.chars().all(|c| c.is_ascii_digit()) { return Err("bad gYear format".to_string()); } s.parse::().map_err(|e| e.to_string()) diff --git a/xsd-types/src/types/gyearmonth.rs b/xsd-types/src/types/gyearmonth.rs index eea59617..2af9fabe 100644 --- a/xsd-types/src/types/gyearmonth.rs +++ b/xsd-types/src/types/gyearmonth.rs @@ -86,12 +86,12 @@ fn parse_str_positive(s: &str) -> Result { return Err("bad gYearMonth format".to_string()); } - if !year_token.chars().all(|c| c.is_digit(10)) { + if !year_token.chars().all(|c| c.is_ascii_digit()) { return Err("bad year format within gYearMonth".to_string()); } let year = year_token.parse::().map_err(|e| e.to_string())?; - if !month_token.chars().all(|c| c.is_digit(10)) { + if !month_token.chars().all(|c| c.is_ascii_digit()) { return Err("bad month format within gYearMonth".to_string()); } let month = month_token.parse::().map_err(|e| e.to_string())?; diff --git a/xsd-types/src/types/utils.rs b/xsd-types/src/types/utils.rs index 51b7ee21..f2cd6bb1 100644 --- a/xsd-types/src/types/utils.rs +++ b/xsd-types/src/types/utils.rs @@ -10,7 +10,7 @@ pub fn parse_timezone(s: &str) -> Result { if tokens.len() != 2 || tokens[0].len() != 2 || tokens[1].len() != 2 { return Err("bad timezone format".to_string()); } - if !tokens.iter().all(|t| t.chars().all(|c| c.is_digit(10))) { + if !tokens.iter().all(|t| t.chars().all(|c| c.is_ascii_digit())) { return Err("bad timezone format".to_string()); }