updates for clippy 1.62

This commit is contained in:
Folkert 2022-07-05 12:23:27 +02:00
parent 4523e90bc7
commit 9c856fd5ae
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
12 changed files with 75 additions and 56 deletions

View file

@ -29,7 +29,7 @@ impl Length {
} else if self.0 > 0 {
Kind::Interned(self.0 as usize)
} else {
Kind::Generated(self.0.abs() as usize)
Kind::Generated(self.0.unsigned_abs() as usize)
}
}

View file

@ -106,7 +106,7 @@ impl<'a> From<&'a str> for ModuleName {
}
}
impl<'a> From<IdentStr> for ModuleName {
impl From<IdentStr> for ModuleName {
fn from(string: IdentStr) -> Self {
Self(string.as_str().into())
}
@ -152,7 +152,7 @@ impl<'a> From<&'a str> for ForeignSymbol {
}
}
impl<'a> From<String> for ForeignSymbol {
impl From<String> for ForeignSymbol {
fn from(string: String) -> Self {
Self(string.into())
}
@ -174,7 +174,7 @@ impl<'a> From<&'a str> for Uppercase {
}
}
impl<'a> From<String> for Uppercase {
impl From<String> for Uppercase {
fn from(string: String) -> Self {
Self(string.into())
}
@ -198,7 +198,7 @@ impl<'a> From<&'a Lowercase> for &'a str {
}
}
impl<'a> From<String> for Lowercase {
impl From<String> for Lowercase {
fn from(string: String) -> Self {
Self(string.into())
}

View file

@ -181,7 +181,10 @@ impl fmt::Debug for Symbol {
// might be used in a panic error message, and if we panick
// while we're already panicking it'll kill the process
// without printing any of the errors!
println!("DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {:?}", err);
use std::io::Write;
let mut stderr = std::io::stderr();
writeln!(stderr, "DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {:?}", err).unwrap();
fallback_debug_fmt(*self, f)
}

View file

@ -1451,7 +1451,7 @@ macro_rules! word1_check_indent {
($word:expr, $word_problem:expr, $min_indent:expr, $indent_problem:expr) => {
and!(
word1($word, $word_problem),
crate::parser::check_indent($min_indent, $indent_problem)
$crate::parser::check_indent($min_indent, $indent_problem)
)
};
}

View file

@ -6,6 +6,7 @@ use crate::types::{name_type_var, RecordField, Uls};
use roc_collections::all::MutMap;
use roc_module::ident::{Lowercase, TagName};
use roc_module::symbol::{Interns, ModuleId, Symbol};
use std::fmt::Write;
pub static WILDCARD: &str = "*";
static EMPTY_RECORD: &str = "{}";
@ -1145,9 +1146,7 @@ fn write_flat_type<'a>(
)
})
}
Erroneous(problem) => {
buf.push_str(&format!("<Type Mismatch: {:?}>", problem));
}
Erroneous(problem) => write!(buf, "<Type Mismatch: {:?}>", problem).unwrap(),
}
}

View file

@ -11,6 +11,7 @@ use roc_module::low_level::LowLevel;
use roc_module::symbol::{Interns, ModuleId, Symbol};
use roc_region::all::{Loc, Region};
use std::fmt;
use std::fmt::Write;
pub const TYPE_NUM: &str = "Num";
pub const TYPE_INTEGER: &str = "Integer";
@ -2299,7 +2300,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
buf.push('(');
}
buf.push_str(name.as_str());
buf.push_str(&format!(" has {:?}", symbol));
write!(buf, "has {:?}", symbol).unwrap();
if write_parens {
buf.push(')');
}
@ -2310,7 +2311,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
if write_parens {
buf.push('(');
}
buf.push_str(&format!("{:?}", symbol));
write!(buf, "{:?}", symbol).unwrap();
for arg in arguments {
buf.push(' ');
@ -2355,7 +2356,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
if write_parens {
buf.push('(');
}
buf.push_str(&format!("{:?}", symbol));
write!(buf, "{:?}", symbol).unwrap();
for arg in arguments {
buf.push(' ');
@ -2434,7 +2435,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
let mut it = tags.into_iter().peekable();
while let Some((tag, args)) = it.next() {
buf.push_str(&format!("{:?}", tag));
write!(buf, "{:?}", tag).unwrap();
for arg in args {
buf.push(' ');
write_debug_error_type_help(arg, buf, Parens::InTypeParam);
@ -2453,7 +2454,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
let mut it = tags.into_iter().peekable();
while let Some((tag, args)) = it.next() {
buf.push_str(&format!("{:?}", tag));
write!(buf, "{:?}", tag).unwrap();
for arg in args {
buf.push(' ');
write_debug_error_type_help(arg, buf, Parens::Unnecessary);