Skip to content

Commit 4227bc1

Browse files
committed
update TestResult deserialization and minicrater clippy result
1 parent facd920 commit 4227bc1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/results/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,21 @@ macro_rules! test_result_enum {
125125
type Err = ::failure::Error;
126126

127127
fn from_str(input: &str) -> Fallible<Self> {
128-
let parts: Vec<&str> = input.split(':').collect();
128+
// if there is more than one ':' we assume it's part of a failure reason serialization
129+
let parts: Vec<&str> = input.splitn(2, ':').collect();
129130

130131
if parts.len() == 1 {
131132
match parts[0] {
132133
$($with_reason_repr => Ok($name::$with_reason_name($reason::Unknown)),)*
133134
$($reasonless_repr => Ok($name::$reasonless_name),)*
134135
other => Err(TestResultParseError::UnknownResult(other.into()).into()),
135136
}
136-
} else if parts.len() == 2 {
137+
} else {
137138
match parts[0] {
138139
$($reasonless_repr => Err(TestResultParseError::UnexpectedFailureReason.into()),)*
139140
$($with_reason_repr => Ok($name::$with_reason_name(parts[1].parse()?)),)*
140141
other => Err(TestResultParseError::UnknownResult(other.into()).into()),
141142
}
142-
} else {
143-
Err(TestResultParseError::TooManySegments.into())
144143
}
145144
}
146145
}
@@ -162,8 +161,6 @@ pub enum TestResultParseError {
162161
UnknownResult(String),
163162
#[fail(display = "unexpected failure reason")]
164163
UnexpectedFailureReason,
165-
#[fail(display = "too many segments")]
166-
TooManySegments,
167164
}
168165

169166
// simplified and lighter version of cargo-metadata::diagnostic::DiagnosticCode

tests/minicrater/clippy/results.expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
{
3333
"log": "stable%2Brustflags=-Dclippy::all/local/clippy-warn",
34-
"res": "build-fail:unknown"
34+
"res": "build-fail:compiler-error(clippy::print_with_newline)"
3535
}
3636
],
3737
"url": "https://github.com/rust-lang/crater/tree/master/local-crates/clippy-warn"

0 commit comments

Comments
 (0)