Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ jobs:
run: rustup component add rustfmt clippy llvm-tools-preview

- name: Install cargo-nextest
uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518
uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d
with:
tool: cargo-nextest

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518
uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d
with:
tool: cargo-llvm-cov

- name: Install cargo-audit
uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518
uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d
with:
tool: cargo-audit

# Needed by the prek `comment-ratio` hook (source_size.py gate). tokei has no
# prebuilt release binary and is not in taiki-e/install-action, so install the
# same conda-forge build run locally via pixi; bump the pin alongside AGENTS.md.
- name: Install tokei
uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347
uses: prefix-dev/setup-pixi@d3f436a425481402e6a95a1d1fc10331c708cd9e
with:
run-install: false
global-environments: tokei=14.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ jobs:
# running `cargo install cross`, whose crates.io fetch is a transient-failure point.
- name: Install cross
if: startsWith(matrix.runner, 'ubuntu')
uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518
uses: taiki-e/install-action@37f7c5781271959fb65b6b35224e28652ff2b63d
with:
tool: cross
- name: Build binaries for ${{ matrix.target }}
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ unicode-normalization = "0.1"
encoding_rs = "0.8"
toml = "1.1.2"
pulldown-cmark = { version = "0.13.4", default-features = false }
quick-xml = { version = "0.41", default-features = false }
quick-xml = { version = "0.42", default-features = false }
sha2 = "0.11"
same-file = "1.0.6"
lsp-server = { version = "0.10.0", optional = true }
Expand Down
30 changes: 15 additions & 15 deletions tests/property_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ fn arb_entries() -> impl Strategy<Value = Vec<ReportEntry>> {
proptest::collection::vec(arb_entry(), 0..6)
}

/// The value of `element`'s `key` attribute, decoded lossily, if present.
fn read_attr(element: &quick_xml::events::BytesStart, key: &[u8]) -> Option<String> {
element.attributes().flatten().find_map(|attr| {
(attr.key.as_ref() == key)
.then(|| String::from_utf8_lossy(attr.value.as_ref()).into_owned())
})
/// The raw (still XML-escaped) value of `element`'s `key` attribute, if present.
fn read_attr(element: &quick_xml::events::BytesStart, key: &str) -> Option<String> {
element
.attributes()
.flatten()
.find_map(|attr| (attr.key.as_ref() == key).then(|| attr.value.into_owned()))
}

proptest! {
Expand Down Expand Up @@ -199,25 +199,25 @@ proptest! {
Ok(Event::Eof) => break,
Ok(Event::Start(element) | Event::Empty(element)) => {
match element.name().as_ref() {
b"testsuites" => {
root_tests = read_attr(&element, b"tests")
"testsuites" => {
root_tests = read_attr(&element, "tests")
.and_then(|value| value.parse::<usize>().ok());
root_failures = read_attr(&element, b"failures")
root_failures = read_attr(&element, "failures")
.and_then(|value| value.parse::<usize>().ok());
root_errors = read_attr(&element, b"errors")
root_errors = read_attr(&element, "errors")
.and_then(|value| value.parse::<usize>().ok());
}
b"testsuite" => suite_names.clear(),
b"testcase" => {
"testsuite" => suite_names.clear(),
"testcase" => {
testcases += 1;
let name = read_attr(&element, b"name").unwrap_or_default();
let name = read_attr(&element, "name").unwrap_or_default();
prop_assert!(
suite_names.insert(name.clone()),
"duplicate testcase name {name} within a suite"
);
}
b"failure" => failures += 1,
b"error" => errors += 1,
"failure" => failures += 1,
"error" => errors += 1,
_ => {}
}
}
Expand Down
24 changes: 11 additions & 13 deletions tests/report_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ fn element_counts(xml: &str) -> HashMap<String, usize> {
.expect("junit output is well-formed XML")
{
Event::Start(element) | Event::Empty(element) => {
let name =
String::from_utf8_lossy(element.name().as_ref()).into_owned();
*counts.entry(name).or_insert(0) += 1;
*counts
.entry(element.name().as_ref().to_owned())
.or_insert(0) += 1;
}
Event::Eof => break,
_ => {}
Expand Down Expand Up @@ -275,14 +275,12 @@ fn junit_disambiguates_testcases_at_an_identical_position() {
loop {
match reader.read_event().expect("well-formed XML") {
Event::Start(element) | Event::Empty(element)
if element.name().as_ref() == b"testcase" =>
if element.name().as_ref() == "testcase" =>
{
for attr in element.attributes() {
let attr = attr.expect("valid attribute");
if attr.key.as_ref() == b"name" {
names.push(
String::from_utf8_lossy(attr.value.as_ref()).into_owned(),
);
if attr.key.as_ref() == "name" {
names.push(attr.value.into_owned());
}
}
}
Expand Down Expand Up @@ -312,17 +310,17 @@ fn junit_escapes_special_characters_in_messages() {
let mut reader = Reader::from_str(&xml);
let message = loop {
match reader.read_event().expect("well-formed XML") {
Event::Start(element) if element.name().as_ref() == b"failure" => {
Event::Start(element) if element.name().as_ref() == "failure" => {
let attr = element
.attributes()
.find_map(|attr| {
let attr = attr.expect("valid attribute");
(attr.key.as_ref() == b"message").then_some(attr)
(attr.key.as_ref() == "message").then_some(attr)
})
.expect("failure has a message attribute");
let escaped =
std::str::from_utf8(attr.value.as_ref()).expect("UTF-8 value");
break unescape(escaped).expect("attribute unescapes").into_owned();
break unescape(&attr.value)
.expect("attribute unescapes")
.into_owned();
}
Event::Eof => panic!("no failure element found"),
_ => {}
Expand Down