Skip to content

Commit

Permalink
refactor: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun authored and DevinR528 committed Jul 25, 2022
1 parent 9b5e523 commit e6a795b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn fmt_table(table: &mut Table, config: &Config) {
#[cfg(target_os = "windows")]
const NEWLINE_PATTERN: &'static str = "\r\n";
#[cfg(not(target_os = "windows"))]
const NEWLINE_PATTERN: &'static str = "\n";
const NEWLINE_PATTERN: &str = "\n";
// Checks the header decor for blank lines
let blank_header_lines =
table.header_decor().prefix().lines().filter(|l| !l.starts_with('#')).count();
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn check_toml(
}

if config.crlf && !sorted_str.contains("\r\n") {
sorted_str = sorted_str.replace("\n", "\r\n")
sorted_str = sorted_str.replace('\n', "\r\n")
}

if matches.is_present("print") {
Expand Down
10 changes: 5 additions & 5 deletions src/toml_edit/parser/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parse!(integer() -> i64, {
attempt(parse_octal_integer()),
attempt(parse_binary_integer()),
parse_integer()
.and_then(|s| s.replace("_", "").parse())
.and_then(|s| s.replace('_', "").parse())
.message("While parsing an Integer")
)
});
Expand All @@ -61,7 +61,7 @@ parse!(parse_hex_integer() -> i64, {
skip_many1(hex_digit()),
)),
).map(|t| t.0)
)).and_then(|s: &str| i64::from_str_radix(&s.replace("_", ""), 16))
)).and_then(|s: &str| i64::from_str_radix(&s.replace('_', ""), 16))
.message("While parsing a hexadecimal Integer")
});

Expand All @@ -75,7 +75,7 @@ parse!(parse_octal_integer() -> i64, {
skip_many1(oct_digit()),
)),
).map(|t| t.0)
)).and_then(|s: &str| i64::from_str_radix(&s.replace("_", ""), 8))
)).and_then(|s: &str| i64::from_str_radix(&s.replace('_', ""), 8))
.message("While parsing an octal Integer")
});

Expand All @@ -89,7 +89,7 @@ parse!(parse_binary_integer() -> i64, {
skip_many1(satisfy(|c: char| c.is_digit(0x2))),
)),
).map(|t| t.0)
)).and_then(|s: &str| i64::from_str_radix(&s.replace("_", ""), 2))
)).and_then(|s: &str| i64::from_str_radix(&s.replace('_', ""), 2))
.message("While parsing a binary Integer")
});

Expand Down Expand Up @@ -134,6 +134,6 @@ parse!(parse_float() -> &'a str, {

parse!(float() -> f64, {
parse_float()
.and_then(|s| s.replace("_", "").parse())
.and_then(|s| s.replace('_', "").parse())
.message("While parsing a Float")
});

0 comments on commit e6a795b

Please sign in to comment.