fix(clippy): misc clippy fixes

This commit is contained in:
Kat Marchán 2022-04-03 18:33:51 -07:00
parent a0b972f876
commit b98b098282
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
5 changed files with 152 additions and 155 deletions

View File

@ -165,13 +165,10 @@ impl GraphicalReportHandler {
"".to_string()
};
let link = format!(
"\u{1b}]8;;{}\u{1b}\\{}\u{1b}]8;;\u{1b}\\",
"\u{1b}]8;;{}\u{1b}\\{}{}\u{1b}]8;;\u{1b}\\",
url,
format!(
"{}{}",
code.style(severity_style),
"(link)".style(self.theme.styles.link)
)
);
write!(header, "{}", link)?;
writeln!(f, "{}", header)?;
@ -417,7 +414,7 @@ impl GraphicalReportHandler {
// And _now_ we can print out the line text itself!
if let Some(w) = self.tab_width {
let text = line.text.replace("\t", " ".repeat(w).as_str());
let text = line.text.replace('\t', " ".repeat(w).as_str());
writeln!(f, "{}", text)?;
} else {
writeln!(f, "{}", line.text)?;

View File

@ -846,7 +846,7 @@ fn related_source_code_propagation() -> Result<(), MietteError> {
let src = "source\n text\n here".to_string();
let err = MyBad {
src: NamedSource::new("bad_file.rs", src.clone()),
src: NamedSource::new("bad_file.rs", src),
highlight: (9, 4).into(),
related: vec![InnerError {
highlight: (0, 6).into(),

View File

@ -631,7 +631,7 @@ fn related_source_code_propagation() -> Result<(), MietteError> {
let src = "source\n text\n here".to_string();
let err = MyBad {
src: NamedSource::new("bad_file.rs", src.clone()),
src: NamedSource::new("bad_file.rs", src),
highlight: (9, 4).into(),
related: vec![InnerError {
highlight: (0, 6).into(),

View File

@ -142,6 +142,6 @@ fn attr_not_required() {
highlight: (9, 4).into(),
};
let err_span = err.labels().unwrap().next().unwrap();
let expectation = LabeledSpan::new(Some("this bit here".into()), 9usize.into(), 4usize.into());
let expectation = LabeledSpan::new(Some("this bit here".into()), 9usize, 4usize);
assert_eq!(err_span, expectation);
}

View File

@ -834,7 +834,7 @@ mod json_report_handler {
let src = "source\n text\n here".to_string();
let err = MyBad {
src: NamedSource::new("bad_file.rs", src.clone()),
src: NamedSource::new("bad_file.rs", src),
highlight: (9, 4).into(),
related: vec![
InnerError {