Skip to content

Commit d8dd37e

Browse files
Merge pull request #139 from lumeohq/dmitry/fix-clippy-warnings
Fix clippy warnings
2 parents 7f3d433 + beb2ccd commit d8dd37e

File tree

10 files changed

+20
-19
lines changed

10 files changed

+20
-19
lines changed

wsdl-parser/src/parser/port_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ impl<'a> OperationType<'a> {
147147
assert_eq!(
148148
output_node.wsdl_type(),
149149
ElementType::Output,
150-
"{}",
151-
format!("{:?}", output_node)
150+
"{:?}",
151+
output_node
152152
);
153153
OperationType::RequestResponse {
154154
input: Param::new(&ch),

xsd-parser/src/parser/union.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::cell::RefCell;
1212
pub fn parse_union(union: &Node) -> RsEntity {
1313
let mut cases = union
1414
.attribute(attribute::MEMBER_TYPES)
15-
.map(|s| create_enum_cases(s))
15+
.map(create_enum_cases)
1616
.unwrap_or_else(Vec::new);
1717

1818
let subtypes = union

xsd-types/src/types/decimal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl FromStr for Decimal {
2626

2727
impl fmt::Display for Decimal {
2828
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
29-
write!(f, "{}", self.0.to_string())
29+
write!(f, "{}", self.0)
3030
}
3131
}
3232

xsd-types/src/types/duration.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fmt;
2+
use std::fmt::Write;
23
use std::str::FromStr;
34
use xsd_macro_utils::UtilsDefaultSerde;
45

@@ -166,7 +167,7 @@ impl FromStr for Duration {
166167
context.is_dot_found = true;
167168
}
168169
digit => {
169-
if !digit.is_digit(10) {
170+
if !digit.is_ascii_digit() {
170171
return Err("Incorrect character occurred".into());
171172
}
172173

@@ -215,24 +216,24 @@ impl fmt::Display for Duration {
215216

216217
let mut date_str = String::new();
217218
if self.years > 0 {
218-
date_str.push_str(&format!("{}Y", self.years));
219+
write!(&mut date_str, "{}Y", self.years)?;
219220
}
220221
if self.months > 0 {
221-
date_str.push_str(&format!("{}M", self.months));
222+
write!(&mut date_str, "{}M", self.months)?;
222223
}
223224
if self.days > 0 {
224-
date_str.push_str(&format!("{}D", self.days));
225+
write!(&mut date_str, "{}D", self.days)?;
225226
}
226227

227228
let mut time_str = String::new();
228229
if self.hours > 0 {
229-
time_str.push_str(&format!("{}H", self.hours));
230+
write!(&mut time_str, "{}H", self.hours)?;
230231
}
231232
if self.minutes > 0 {
232-
time_str.push_str(&format!("{}M", self.minutes));
233+
write!(&mut time_str, "{}M", self.minutes)?;
233234
}
234235
if self.seconds > 0.0 {
235-
time_str.push_str(&format!("{}S", self.seconds));
236+
write!(&mut time_str, "{}S", self.seconds)?;
236237
}
237238

238239
if time_str.is_empty() {

xsd-types/src/types/gday.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl FromStr for GDay {
4141
return Err("bad gDay format".to_string());
4242
}
4343
let token = &s[3..5];
44-
if !token.chars().all(|c| c.is_digit(10)) {
44+
if !token.chars().all(|c| c.is_ascii_digit()) {
4545
return Err("bad gDay format".to_string());
4646
}
4747
token.parse::<i32>().map_err(|e| e.to_string())

xsd-types/src/types/gmonth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl FromStr for GMonth {
4141
return Err("bad gMonth format".to_string());
4242
}
4343
let token = &s[2..4];
44-
if !token.chars().all(|c| c.is_digit(10)) {
44+
if !token.chars().all(|c| c.is_ascii_digit()) {
4545
return Err("bad gMonth format".to_string());
4646
}
4747
token.parse::<i32>().map_err(|e| e.to_string())

xsd-types/src/types/gmonthday.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ impl FromStr for GMonthDay {
7171
}
7272

7373
let month_token = &s[2..4];
74-
if !month_token.chars().all(|c| c.is_digit(10)) {
74+
if !month_token.chars().all(|c| c.is_ascii_digit()) {
7575
return Err("bad month format within gMonthDay".to_string());
7676
}
7777
let month = month_token.parse::<i32>().map_err(|e| e.to_string())?;
7878

7979
let day_token = &s[5..7];
80-
if !day_token.chars().all(|c| c.is_digit(10)) {
80+
if !day_token.chars().all(|c| c.is_ascii_digit()) {
8181
return Err("bad day format within gMonthDay".to_string());
8282
}
8383
let day = day_token.parse::<i32>().map_err(|e| e.to_string())?;

xsd-types/src/types/gyear.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn parse_str_positive(s: &str) -> Result<GYear, String> {
5353
if s.len() < 4 {
5454
return Err("bad gYear format: to short".to_string());
5555
}
56-
if !s.chars().all(|c| c.is_digit(10)) {
56+
if !s.chars().all(|c| c.is_ascii_digit()) {
5757
return Err("bad gYear format".to_string());
5858
}
5959
s.parse::<i32>().map_err(|e| e.to_string())

xsd-types/src/types/gyearmonth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ fn parse_str_positive(s: &str) -> Result<GYearMonth, String> {
8686
return Err("bad gYearMonth format".to_string());
8787
}
8888

89-
if !year_token.chars().all(|c| c.is_digit(10)) {
89+
if !year_token.chars().all(|c| c.is_ascii_digit()) {
9090
return Err("bad year format within gYearMonth".to_string());
9191
}
9292
let year = year_token.parse::<i32>().map_err(|e| e.to_string())?;
9393

94-
if !month_token.chars().all(|c| c.is_digit(10)) {
94+
if !month_token.chars().all(|c| c.is_ascii_digit()) {
9595
return Err("bad month format within gYearMonth".to_string());
9696
}
9797
let month = month_token.parse::<i32>().map_err(|e| e.to_string())?;

xsd-types/src/types/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn parse_timezone(s: &str) -> Result<FixedOffset, String> {
1010
if tokens.len() != 2 || tokens[0].len() != 2 || tokens[1].len() != 2 {
1111
return Err("bad timezone format".to_string());
1212
}
13-
if !tokens.iter().all(|t| t.chars().all(|c| c.is_digit(10))) {
13+
if !tokens.iter().all(|t| t.chars().all(|c| c.is_ascii_digit())) {
1414
return Err("bad timezone format".to_string());
1515
}
1616

0 commit comments

Comments
 (0)