update with new clippy lints

This commit is contained in:
Folkert 2022-03-31 19:34:51 +02:00
parent 51b360b578
commit 0dd2cec09a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
22 changed files with 53 additions and 77 deletions

View file

@ -166,8 +166,7 @@ fn sort_type_defs_before_introduction(
Ok(result) => result
.iter()
.rev()
.map(|group_index| sccs[*group_index].iter())
.flatten()
.flat_map(|group_index| sccs[*group_index].iter())
.copied()
.collect(),

View file

@ -281,8 +281,7 @@ pub fn canonicalize_module_defs<'a>(
let transitive_builtins: Vec<Symbol> = referenced_values
.iter()
.filter(|s| s.is_builtin())
.map(|s| crate::builtins::builtin_dependencies(*s))
.flatten()
.flat_map(|s| crate::builtins::builtin_dependencies(*s))
.copied()
.collect();

View file

@ -110,7 +110,7 @@ pub enum ParsedNumResult {
pub fn finish_parsing_num(raw: &str) -> Result<ParsedNumResult, (&str, IntErrorKind)> {
// Ignore underscores.
let radix = 10;
from_str_radix(raw.replace("_", "").as_str(), radix).map_err(|e| (raw, e))
from_str_radix(raw.replace('_', "").as_str(), radix).map_err(|e| (raw, e))
}
#[inline(always)]
@ -128,9 +128,9 @@ pub fn finish_parsing_base(
// Ignore underscores, insert - when negative to get correct underflow/overflow behavior
(if is_negative {
from_str_radix(format!("-{}", raw.replace("_", "")).as_str(), radix)
from_str_radix(format!("-{}", raw.replace('_', "")).as_str(), radix)
} else {
from_str_radix(raw.replace("_", "").as_str(), radix)
from_str_radix(raw.replace('_', "").as_str(), radix)
})
.and_then(|parsed| match parsed {
ParsedNumResult::Float(..) => Err(IntErrorKind::FloatSuffix),
@ -154,7 +154,7 @@ pub fn finish_parsing_float(raw: &str) -> Result<(f64, FloatBound), (&str, Float
};
// Ignore underscores.
match raw_without_suffix.replace("_", "").parse::<f64>() {
match raw_without_suffix.replace('_', "").parse::<f64>() {
Ok(float) if float.is_finite() => Ok((float, bound)),
Ok(float) => {
if float.is_sign_positive() {