make ui_test pass clippy

This commit is contained in:
Ralf Jung 2022-06-29 18:17:28 -04:00
parent 02f8cb2d55
commit e33efc7517
5 changed files with 11 additions and 9 deletions

2
miri
View File

@ -168,7 +168,7 @@ fmt)
;;
clippy)
cargo clippy $CARGO_BUILD_FLAGS --manifest-path "$MIRIDIR"/Cargo.toml --all-targets "$@"
#cargo clippy $CARGO_BUILD_FLAGS --manifest-path "$MIRIDIR"/ui_test/Cargo.toml --all-targets "$@"
cargo clippy $CARGO_BUILD_FLAGS --manifest-path "$MIRIDIR"/ui_test/Cargo.toml --all-targets "$@"
cargo clippy $CARGO_BUILD_FLAGS --manifest-path "$MIRIDIR"/cargo-miri/Cargo.toml "$@"
;;
*)

View File

@ -90,7 +90,7 @@ impl Comments {
path.display()
);
this.revisions =
Some(revisions.trim().split_whitespace().map(|s| s.to_string()).collect());
Some(revisions.split_whitespace().map(|s| s.to_string()).collect());
}
if let Some(s) = line.strip_prefix("// ignore-") {
let s = s

View File

@ -1,3 +1,5 @@
#![allow(clippy::enum_variant_names, clippy::useless_format, clippy::too_many_arguments)]
use std::collections::VecDeque;
use std::fmt::Write;
use std::path::{Path, PathBuf};
@ -338,17 +340,17 @@ fn check_test_result(
revised("stderr"),
target,
&config.stderr_filters,
&config,
config,
comments,
);
check_output(
&stdout,
stdout,
path,
errors,
revised("stdout"),
target,
&config.stdout_filters,
&config,
config,
comments,
);
// Check error annotations in the source against output

View File

@ -117,16 +117,16 @@ impl Span {
pub(crate) fn filter_annotations_from_rendered(rendered: &str) -> std::borrow::Cow<'_, str> {
let annotations = Regex::new(r"\s*//(\[[^\]]\])?~.*").unwrap();
annotations.replace_all(&rendered, "")
annotations.replace_all(rendered, "")
}
pub(crate) fn process(file: &Path, stderr: &[u8]) -> Diagnostics {
let stderr = std::str::from_utf8(&stderr).unwrap();
let stderr = std::str::from_utf8(stderr).unwrap();
let mut rendered = String::new();
let mut messages = vec![];
let mut messages_from_unknown_file_or_line = vec![];
for line in stderr.lines() {
if line.starts_with("{") {
if line.starts_with('{') {
match serde_json::from_str::<RustcMessage>(line) {
Ok(msg) => {
write!(

View File

@ -29,7 +29,7 @@ fn main() {
}
";
let path = Path::new("$DIR/<dummy>");
let comments = Comments::parse(&path, s);
let comments = Comments::parse(path, s);
let mut errors = vec![];
let config = config();
let messages = vec![