Skip to content

Commit 2dd062f

Browse files
committed
refactor(test): Move normalize functions after use
1 parent 91a58e2 commit 2dd062f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

crates/cargo-test-support/src/compare.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -331,27 +331,6 @@ static E2E_LITERAL_REDACTIONS: &[(&str, &str)] = &[
331331
("[OPENING]", " Opening"),
332332
];
333333

334-
/// Normalizes the output so that it can be compared against the expected value.
335-
fn normalize_actual(content: &str, redactions: &snapbox::Redactions) -> String {
336-
use snapbox::filter::Filter as _;
337-
let content = snapbox::filter::FilterPaths.filter(content.into_data());
338-
let content = snapbox::filter::FilterNewlines.filter(content);
339-
let content = content.render().expect("came in as a String");
340-
let content = redactions.redact(&content);
341-
content
342-
}
343-
344-
/// Normalizes the expected string so that it can be compared against the actual output.
345-
fn normalize_expected(content: &str, redactions: &snapbox::Redactions) -> String {
346-
use snapbox::filter::Filter as _;
347-
let content = snapbox::filter::FilterPaths.filter(content.into_data());
348-
let content = snapbox::filter::FilterNewlines.filter(content);
349-
// Remove any conditionally absent redactions like `[EXE]`
350-
let content = content.render().expect("came in as a String");
351-
let content = redactions.clear_unused(&content);
352-
content.into_owned()
353-
}
354-
355334
/// Checks that the given string contains the given contiguous lines
356335
/// somewhere.
357336
///
@@ -457,6 +436,27 @@ pub(crate) fn match_with_without(
457436
}
458437
}
459438

439+
/// Normalizes the output so that it can be compared against the expected value.
440+
fn normalize_actual(content: &str, redactions: &snapbox::Redactions) -> String {
441+
use snapbox::filter::Filter as _;
442+
let content = snapbox::filter::FilterPaths.filter(content.into_data());
443+
let content = snapbox::filter::FilterNewlines.filter(content);
444+
let content = content.render().expect("came in as a String");
445+
let content = redactions.redact(&content);
446+
content
447+
}
448+
449+
/// Normalizes the expected string so that it can be compared against the actual output.
450+
fn normalize_expected(content: &str, redactions: &snapbox::Redactions) -> String {
451+
use snapbox::filter::Filter as _;
452+
let content = snapbox::filter::FilterPaths.filter(content.into_data());
453+
let content = snapbox::filter::FilterNewlines.filter(content);
454+
// Remove any conditionally absent redactions like `[EXE]`
455+
let content = content.render().expect("came in as a String");
456+
let content = redactions.clear_unused(&content);
457+
content.into_owned()
458+
}
459+
460460
/// A single line string that supports `[..]` wildcard matching.
461461
pub(crate) struct WildStr<'a> {
462462
has_meta: bool,

0 commit comments

Comments
 (0)