Skip to content

Commit ec3200e

Browse files
SimonCroppEvangelink
authored andcommitted
fix nullablity in FromFailedTest (#5971)
1 parent 86e772b commit ec3200e

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/FailedTestHelper.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,16 @@ internal static void FromFailedTest(this FailedTestInfoRequest failedTestInfoReq
7171
string nameAndPlace = place == null
7272
? $"{failedTestInfoRequest.DisplayName} ({failedTestInfoRequest.Duration})"
7373
: $"{failedTestInfoRequest.DisplayName} ({failedTestInfoRequest.Duration}): {place}";
74-
string? singleLineError = JoinSingleLineAndShorten(nameAndPlace, failedTestInfoRequest.ErrorMessage);
7574

76-
message = singleLineError!;
75+
message = JoinSingleLineAndShorten(nameAndPlace, failedTestInfoRequest.ErrorMessage);
7776
}
7877
}
7978

80-
private static string? JoinSingleLineAndShorten(string first, string? second)
79+
private static string JoinSingleLineAndShorten(string first, string? second)
8180
=> second == null
8281
? SingleLineAndShorten(first)
8382
: SingleLineAndShorten(first) + " " + SingleLineAndShorten(second);
8483

85-
private static string? SingleLineAndShorten(string? text)
86-
=> text == null ? null : (text.Length <= 1000 ? text : text[..1000]).Replace('\r', ' ').Replace('\n', ' ');
84+
private static string SingleLineAndShorten(string text) =>
85+
(text.Length <= 1000 ? text : text[..1000]).Replace('\r', ' ').Replace('\n', ' ');
8786
}

0 commit comments

Comments
 (0)