-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
The custom message in assert_eq!(...) macro is shown right after the right:
. This is hard to read because the value strings could be very long. I think it is better to print the custom message (if available) on a separate line.
fn main() {
let a = 10;
let b = 20;
assert_eq!(a, b, "Values {a} and {b}");
}
The above code (playground) prints this:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `10`,
right: `20`: Values 10 and 20', src/main.rs:4:5
Suggested output
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `10`,
right: `20`,
context: Values 10 and 20', src/main.rs:4:5
Note that custom message and the location in source are still on the same line
quixoticaxis, edmorley, TimJentzsch, farazdagi, philbucher and 4 more
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.