From 97bc94e9fe6e99529c9734ba4da0f12ebb6e195d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 4 Jan 2023 22:10:13 +0000 Subject: [PATCH] Delete 'full type name' notes --- src/normalize.rs | 9 +++++++++ src/tests.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/normalize.rs b/src/normalize.rs index 30e600c..37bb3cb 100644 --- a/src/normalize.rs +++ b/src/normalize.rs @@ -48,6 +48,7 @@ normalizations! { LinesOutsideInputFile, Unindent, AndOthers, + StripLongTypeNameFiles, // New normalization steps are to be inserted here at the end so that any // snapshots saved before your normalization change remain passing. } @@ -356,6 +357,14 @@ impl<'a> Filter<'a> { } } + if self.normalization >= StripLongTypeNameFiles { + let trimmed_line = line.trim_start(); + let trimmed_line = trimmed_line.strip_prefix("= note: ").unwrap_or(trimmed_line); + if trimmed_line.starts_with("the full type name has been written to") { + return None; + } + } + line = line.replace(self.context.krate, "$CRATE"); line = replace_case_insensitive(&line, &self.context.source_dir.to_string_lossy(), "$DIR/"); line = replace_case_insensitive( diff --git a/src/tests.rs b/src/tests.rs index d857079..5899705 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -396,3 +396,32 @@ error[E0277]: no implementation for `u8 >> &str` <&'a i128 as Shr> and $N others "} + +test_normalize! {test_long_file_names " +error: reached the recursion limit while instantiating `test::>>>>>` + --> src/main.rs:18:11 + | +18 | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `test` defined here + --> src/main.rs:16:1 + | +16 | fn test (n:isize, i:isize, first:T, second:T) ->isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: the full type name has been written to `/playground/target/debug/deps/playground-c53df771d95c66fb.c7a39e8d0dd9c781.long-type-16688711729771999621.txt` + the full type name has been written to `/playground/target/debug/deps/playground-c53df771d95c66fb.c7a39e8d0dd9c781.long-type-16688711729771999621.txt` +" " +error: reached the recursion limit while instantiating `test::>>>>>` + --> src/main.rs:18:11 + | +18 | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: `test` defined here + --> src/main.rs:16:1 + | +16 | fn test (n:isize, i:isize, first:T, second:T) ->isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +" +}