From f73e10a8df8ddc6391fcd219c8e0311f1f9d5ad9 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 28 Nov 2024 22:48:54 +0100 Subject: [PATCH 01/38] Ignore temp files generated by `cargo insta` --- .gitignore | 3 +- src/.write.rs.pending-snap | 252 ------------------------------------- 2 files changed, 2 insertions(+), 253 deletions(-) delete mode 100644 src/.write.rs.pending-snap diff --git a/.gitignore b/.gitignore index 869df07..2d86629 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -Cargo.lock \ No newline at end of file +Cargo.lock +*.pending-snap diff --git a/src/.write.rs.pending-snap b/src/.write.rs.pending-snap deleted file mode 100644 index 66cf58c..0000000 --- a/src/.write.rs.pending-snap +++ /dev/null @@ -1,252 +0,0 @@ -{"run_id":"1730154368-841895824","line":1139,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1139,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730154368-841895824","line":1072,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1072,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154368-841895824","line":1185,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1185,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154368-841895824","line":1161,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1161,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730154368-841895824","line":1048,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1048,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154368-841895824","line":1332,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1332,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154368-841895824","line":1250,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1250,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | ,-> apple\n : : \n 3 | |-> orange\n | | \n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730154368-841895824","line":1385,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1385,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154368-841895824","line":1358,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1358,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730154368-841895824","line":1462,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1462,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730154368-841895824","line":1118,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1118,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | | \n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730154368-841895824","line":1210,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1210,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154368-841895824","line":1436,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1436,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730154368-841895824","line":964,"new":null,"old":null} -{"run_id":"1730154368-841895824","line":1097,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1097,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^ \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730154368-841895824","line":980,"new":null,"old":null} -{"run_id":"1730154368-841895824","line":1024,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1024,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154368-841895824","line":1300,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1300,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | | \n | `-------------- Have I mentioned that this is an apple?\n | | | \n | `-------------- No really, have I mentioned that?\n | | \n | `---- This is an orange\n | | \n | `---- Have I mentioned that this is an orange?\n | | \n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730154368-841895824","line":1273,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1273,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^ \n | `------------------- scheme\n | | \n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730154368-841895824","line":1412,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1412,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730154368-841895824","line":1000,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1000,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730154463-339062648","line":1139,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1072,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1048,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1210,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1185,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1161,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1358,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1385,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1436,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1118,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1024,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1332,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1462,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1097,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1300,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":964,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1250,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1273,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1412,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":980,"new":null,"old":null} -{"run_id":"1730154463-339062648","line":1000,"new":null,"old":null} -{"run_id":"1730154470-722757339","line":1139,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1139,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730154470-722757339","line":1118,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1118,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | | \n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730154470-722757339","line":1185,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1185,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154470-722757339","line":1048,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1048,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154470-722757339","line":1072,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1072,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154470-722757339","line":1024,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1024,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154470-722757339","line":1161,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1161,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730154470-722757339","line":1462,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1462,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730154470-722757339","line":1436,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1436,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730154470-722757339","line":1358,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1358,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730154470-722757339","line":1332,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1332,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154470-722757339","line":1210,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1210,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154470-722757339","line":1300,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1300,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | | \n | `-------------- Have I mentioned that this is an apple?\n | | | \n | `-------------- No really, have I mentioned that?\n | | \n | `---- This is an orange\n | | \n | `---- Have I mentioned that this is an orange?\n | | \n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730154470-722757339","line":964,"new":null,"old":null} -{"run_id":"1730154470-722757339","line":1097,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1097,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^ \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730154470-722757339","line":980,"new":null,"old":null} -{"run_id":"1730154470-722757339","line":1385,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1385,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154470-722757339","line":1250,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1250,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | ,-> apple\n : : \n 3 | |-> orange\n | | \n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730154470-722757339","line":1000,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1000,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730154470-722757339","line":1273,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1273,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^ \n | `------------------- scheme\n | | \n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730154470-722757339","line":1412,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1412,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730154580-873153354","line":1048,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1048,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154580-873153354","line":964,"new":null,"old":null} -{"run_id":"1730154580-873153354","line":1024,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1024,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154580-873153354","line":1358,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1358,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730154580-873153354","line":1385,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1385,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154580-873153354","line":980,"new":null,"old":null} -{"run_id":"1730154580-873153354","line":1118,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1118,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | | \n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730154580-873153354","line":1139,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1139,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730154580-873153354","line":1161,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1161,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730154580-873153354","line":1462,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1462,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730154580-873153354","line":1210,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1210,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154580-873153354","line":1300,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1300,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | | \n | `-------------- Have I mentioned that this is an apple?\n | | | \n | `-------------- No really, have I mentioned that?\n | | \n | `---- This is an orange\n | | \n | `---- Have I mentioned that this is an orange?\n | | \n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730154580-873153354","line":1332,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1332,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154580-873153354","line":1436,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1436,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730154580-873153354","line":1250,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1250,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | ,-> apple\n : : \n 3 | |-> orange\n | | \n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730154580-873153354","line":1185,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1185,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154580-873153354","line":1072,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1072,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154580-873153354","line":1412,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1412,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730154580-873153354","line":1000,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1000,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730154580-873153354","line":1273,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1273,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^ \n | `------------------- scheme\n | | \n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730154580-873153354","line":1097,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1097,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^ \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730154746-396557371","line":1139,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1139,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730154746-396557371","line":1118,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1118,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | | \n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730154746-396557371","line":1185,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1185,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154746-396557371","line":1161,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1161,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730154746-396557371","line":1024,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1024,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154746-396557371","line":1332,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1332,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154746-396557371","line":964,"new":null,"old":null} -{"run_id":"1730154746-396557371","line":1097,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1097,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^ \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730154746-396557371","line":980,"new":null,"old":null} -{"run_id":"1730154746-396557371","line":1048,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1048,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154746-396557371","line":1462,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1462,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730154746-396557371","line":1210,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1210,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730154746-396557371","line":1436,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1436,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730154746-396557371","line":1358,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1358,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730154746-396557371","line":1250,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1250,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | ,-> apple\n : : \n 3 | |-> orange\n | | \n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730154746-396557371","line":1385,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1385,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730154746-396557371","line":1300,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1300,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | | \n | `-------------- Have I mentioned that this is an apple?\n | | | \n | `-------------- No really, have I mentioned that?\n | | \n | `---- This is an orange\n | | \n | `---- Have I mentioned that this is an orange?\n | | \n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730154746-396557371","line":1072,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1072,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730154746-396557371","line":1412,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1412,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730154746-396557371","line":1273,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1273,"expression":"msg"},"snapshot":"Error: \n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^ \n | `------------------- scheme\n | | \n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730154746-396557371","line":1000,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1000,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730154821-476337710","line":1048,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1139,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1358,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1185,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1072,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1385,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1436,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1161,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1250,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1118,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1210,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1024,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1332,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1462,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1097,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1300,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":964,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1273,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1000,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":980,"new":null,"old":null} -{"run_id":"1730154821-476337710","line":1412,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1161,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1139,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1072,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1048,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1118,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1185,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1210,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1385,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1358,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1436,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1250,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1462,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1024,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1332,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1097,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1300,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":964,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1000,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1412,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":1273,"new":null,"old":null} -{"run_id":"1730154827-858030734","line":980,"new":null,"old":null} -{"run_id":"1730157055-637288002","line":1116,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1116,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | apple ==\n | | \n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730157055-637288002","line":1070,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1070,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:10 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157055-637288002","line":1248,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1248,"expression":"msg"},"snapshot":"Error: \n ,-[ :1:1 ]\n |\n 1 | ,-> apple\n : : \n 3 | |-> orange\n | | \n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730157055-637288002","line":1434,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1434,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730157055-637288002","line":1159,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1159,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730157055-637288002","line":1330,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1330,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157055-637288002","line":1046,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1046,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:1 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157055-637288002","line":1356,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1356,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730157055-637288002","line":1460,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1460,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note 1: No need to try, they can't be compared.\n | \n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730157055-637288002","line":1208,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1208,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Help: have you tried going to the farmer's market?\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157055-637288002","line":1183,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1183,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | \n | | \n | `- No more fruit!\n | \n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157055-637288002","line":1137,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1137,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | \n | | \n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730157055-637288002","line":962,"new":null,"old":null} -{"run_id":"1730157055-637288002","line":1383,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1383,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n | \n | Help: have you tried peeling the orange?\n | \n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157055-637288002","line":1022,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1022,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:1 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an äpplë\n | | \n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157055-637288002","line":1095,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1095,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^ \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730157055-637288002","line":1410,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1410,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^ \n | `--------- This is a strange comparison\n | \n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730157055-637288002","line":1298,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1298,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | | \n | `-------------- Have I mentioned that this is an apple?\n | | | \n | `-------------- No really, have I mentioned that?\n | | \n | `---- This is an orange\n | | \n | `---- Have I mentioned that this is an orange?\n | | \n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730157055-637288002","line":978,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_without_messages","metadata":{"source":"src/write.rs","assertion_line":978,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n---'"}} -{"run_id":"1730157055-637288002","line":1271,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1271,"expression":"msg"},"snapshot":"Error: \n ,-[ :1:1 ]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^ \n | `------------------- scheme\n | | \n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730157055-637288002","line":998,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":998,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^ \n | `-------------- This is an apple\n | | \n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730157606-811403410","line":1337,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1337,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^|^^ ^^^|^^ | `-------------- This is an apple | | | `---- This is an orange | | Note: stop trying ... this is a fruitless endeavor---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157606-811403410","line":969,"new":null,"old":null} -{"run_id":"1730157606-811403410","line":1053,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1053,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës ,-[ :1:1 ] | 1 | äpplë == örängë; | ^^|^^ ^^^|^^ | `-------------- This is an äpplë | | | `---- This is an örängë---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157606-811403410","line":1441,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1441,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^^^^^^|^^^^^^^ | `--------- This is a strange comparison | | Note 1: No need to try, they can't be compared. | | Note 2: Yeah, really, please stop.---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730157606-811403410","line":1144,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1144,"expression":"msg"},"snapshot":"Error: unexpected end of file ,-[ :1:1 ] | 1 | | | | `- No more fruit!---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730157606-811403410","line":1363,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1363,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^|^^ ^^^|^^ | `-------------- This is an apple | | | `---- This is an orange | | Help: have you tried peeling the orange?---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730157606-811403410","line":1102,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1102,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange | ^^|^^ | `---- This is an orange---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730157606-811403410","line":1255,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1255,"expression":"msg"},"snapshot":"Error: ,-[ :1:1 ] | 1 | ,-> apple : : 3 | |-> orange | | | `----------- illegal comparison---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730157606-811403410","line":1166,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1166,"expression":"msg"},"snapshot":"Error: unexpected end of file ,-[ :1:1 ] | 1 | | | | `- No more fruit! | | Help: have you tried going to the farmer's market?---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730157606-811403410","line":1215,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1215,"expression":"msg"},"snapshot":"Error: unexpected end of file ,-[ :1:1 ] | 1 | | | | `- No more fruit! | | Help: have you tried going to the farmer's market? | | Note: eat your greens!---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157606-811403410","line":1390,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1390,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^|^^ ^^^|^^ | `-------------- This is an apple | | | `---- This is an orange | | Help: have you tried peeling the orange? | | Note: stop trying ... this is a fruitless endeavor---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157606-811403410","line":1077,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1077,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës ,-[ :1:10 ] | 1 | äpplë == örängë; | ^^|^^ ^^^|^^ | `-------------- This is an äpplë | | | `---- This is an örängë---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157606-811403410","line":1190,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1190,"expression":"msg"},"snapshot":"Error: unexpected end of file ,-[ :1:1 ] | 1 | | | | `- No more fruit! | | Note: eat your greens!---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157606-811403410","line":1029,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1029,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës ,-[ :1:1 ] | 1 | äpplë == örängë; | ^^|^^ ^^^|^^ | `-------------- This is an äpplë | | | `---- This is an örängë---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157606-811403410","line":1467,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1467,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^^^^^^|^^^^^^^ | `--------- This is a strange comparison | | Note 1: No need to try, they can't be compared. | | Note 2: Yeah, really, please stop. | It has no resemblance.---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730157606-811403410","line":1123,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1123,"expression":"msg"},"snapshot":"Error: unexpected end of file ,-[ :1:1 ] | 1 | apple == | | | `- Unexpected end of file---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730157606-811403410","line":1305,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1305,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^|^^ ^^^|^^ | `-------------- This is an apple | | | | `-------------- Have I mentioned that this is an apple? | | | | `-------------- No really, have I mentioned that? | | | `---- This is an orange | | | `---- Have I mentioned that this is an orange? | | | `---- No really, have I mentioned that?---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730157606-811403410","line":1278,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1278,"expression":"msg"},"snapshot":"Error: ,-[ :1:1 ] | 1 | https://example.com/ | ^^|^^^^^^^|^^^^^^^^^ | `------------------- scheme | | | `----------- URL---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730157606-811403410","line":1005,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1005,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^|^^ ^^^|^^ | `-------------- This is an apple | | | `---- This is an orange---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730157606-811403410","line":985,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_without_messages","metadata":{"source":"src/write.rs","assertion_line":985,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange;---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n---'"}} -{"run_id":"1730157606-811403410","line":1417,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1417,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges ,-[ :1:1 ] | 1 | apple == orange; | ^^^^^^^|^^^^^^^ | `--------- This is a strange comparison | | Note: No need to try, they can't be compared.---'"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730157623-892722616","line":1337,"new":{"module_name":"ariadne__write__tests","snapshot_name":"note","metadata":{"source":"src/write.rs","assertion_line":1337,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157623-892722616","line":969,"new":null,"old":null} -{"run_id":"1730157623-892722616","line":1029,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_byte_chars","metadata":{"source":"src/write.rs","assertion_line":1029,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:1 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157623-892722616","line":1255,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiline_label","metadata":{"source":"src/write.rs","assertion_line":1255,"expression":"msg"},"snapshot":"Error:\n ,-[ :1:1 ]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | ,-> apple\n : :\n 3 | |-> orange\n | |\n | `----------- illegal comparison\n---'"}} -{"run_id":"1730157623-892722616","line":1077,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1077,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:10 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157623-892722616","line":1390,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help_and_note","metadata":{"source":"src/write.rs","assertion_line":1390,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n |\n | Note: stop trying ... this is a fruitless endeavor\n---'"}} -{"run_id":"1730157623-892722616","line":1102,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_at_end_of_long_line","metadata":{"source":"src/write.rs","assertion_line":1102,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange\n | ^^|^^\n | `---- This is an orange\n---'"}} -{"run_id":"1730157623-892722616","line":1053,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_label","metadata":{"source":"src/write.rs","assertion_line":1053,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:1 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:1]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157623-892722616","line":1190,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_note","metadata":{"source":"src/write.rs","assertion_line":1190,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157623-892722616","line":1144,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input","metadata":{"source":"src/write.rs","assertion_line":1144,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 |\n | |\n | `- No more fruit!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n---'"}} -{"run_id":"1730157623-892722616","line":1441,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_single_lines","metadata":{"source":"src/write.rs","assertion_line":1441,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n---'"}} -{"run_id":"1730157623-892722616","line":1363,"new":{"module_name":"ariadne__write__tests","snapshot_name":"help","metadata":{"source":"src/write.rs","assertion_line":1363,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n |\n | Help: have you tried peeling the orange?\n---'"}} -{"run_id":"1730157623-892722616","line":1166,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help","metadata":{"source":"src/write.rs","assertion_line":1166,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n---'"}} -{"run_id":"1730157623-892722616","line":1123,"new":{"module_name":"ariadne__write__tests","snapshot_name":"label_of_width_zero_at_end_of_line","metadata":{"source":"src/write.rs","assertion_line":1123,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 | apple ==\n | |\n | `- Unexpected end of file\n---'"}} -{"run_id":"1730157623-892722616","line":1215,"new":{"module_name":"ariadne__write__tests","snapshot_name":"empty_input_help_note","metadata":{"source":"src/write.rs","assertion_line":1215,"expression":"msg"},"snapshot":"Error: unexpected end of file\n ,-[ :1:1 ]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: unexpected end of file\n ,-[:1:1]\n |\n 1 |\n | |\n | `- No more fruit!\n |\n | Help: have you tried going to the farmer's market?\n |\n | Note: eat your greens!\n---'"}} -{"run_id":"1730157623-892722616","line":1467,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multi_notes_multi_lines","metadata":{"source":"src/write.rs","assertion_line":1467,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note 1: No need to try, they can't be compared.\n |\n | Note 2: Yeah, really, please stop.\n | It has no resemblance.\n---'"}} -{"run_id":"1730157623-892722616","line":1305,"new":{"module_name":"ariadne__write__tests","snapshot_name":"multiple_labels_same_span","metadata":{"source":"src/write.rs","assertion_line":1305,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | | |\n | `-------------- Have I mentioned that this is an apple?\n | | |\n | `-------------- No really, have I mentioned that?\n | |\n | `---- This is an orange\n | |\n | `---- Have I mentioned that this is an orange?\n | |\n | `---- No really, have I mentioned that?\n---'"}} -{"run_id":"1730157623-892722616","line":1278,"new":{"module_name":"ariadne__write__tests","snapshot_name":"partially_overlapping_labels","metadata":{"source":"src/write.rs","assertion_line":1278,"expression":"msg"},"snapshot":"Error:\n ,-[ :1:1 ]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error:\n ,-[:1:1]\n |\n 1 | https://example.com/\n | ^^|^^^^^^^|^^^^^^^^^\n | `------------------- scheme\n | |\n | `----------- URL\n---'"}} -{"run_id":"1730157623-892722616","line":985,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_without_messages","metadata":{"source":"src/write.rs","assertion_line":985,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n---'"}} -{"run_id":"1730157623-892722616","line":1417,"new":{"module_name":"ariadne__write__tests","snapshot_name":"single_note_single_line","metadata":{"source":"src/write.rs","assertion_line":1417,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^^^^^^|^^^^^^^\n | `--------- This is a strange comparison\n |\n | Note: No need to try, they can't be compared.\n---'"}} -{"run_id":"1730157623-892722616","line":1005,"new":{"module_name":"ariadne__write__tests","snapshot_name":"two_labels_with_messages","metadata":{"source":"src/write.rs","assertion_line":1005,"expression":"msg"},"snapshot":"Error: can't compare apples with oranges\n ,-[ :1:1 ]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare apples with oranges\n ,-[:1:1]\n |\n 1 | apple == orange;\n | ^^|^^ ^^^|^^\n | `-------------- This is an apple\n | |\n | `---- This is an orange\n---'"}} -{"run_id":"1730157656-864763666","line":1144,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1166,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1053,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1190,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1467,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1390,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1255,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1441,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1363,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1029,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1123,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1337,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1305,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1215,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1102,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1417,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":969,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1278,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1005,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":985,"new":null,"old":null} -{"run_id":"1730157656-864763666","line":1077,"new":{"module_name":"ariadne__write__tests","snapshot_name":"byte_column","metadata":{"source":"src/write.rs","assertion_line":1077,"expression":"msg"},"snapshot":"Error: can't compare äpplës with örängës\n ,-[ :1:10 ]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'\n"},"old":{"module_name":"ariadne__write__tests","metadata":{},"snapshot":"Error: can't compare äpplës with örängës\n ,-[:1:10]\n |\n 1 | äpplë == örängë;\n | ^^|^^ ^^^|^^\n | `-------------- This is an äpplë\n | |\n | `---- This is an örängë\n---'"}} -{"run_id":"1730157667-704746756","line":1077,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1053,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1144,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1166,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1190,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1363,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1390,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1123,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1441,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1467,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1215,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1337,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1255,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1305,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1029,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1102,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":969,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1278,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1005,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":1417,"new":null,"old":null} -{"run_id":"1730157667-704746756","line":985,"new":null,"old":null} From ba7b721b8055d40974ed53af140d09013e171b8b Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 11:59:12 +0200 Subject: [PATCH 02/38] Factor out a `nb_digits` function And also use a simpler, `log10`-based logic --- src/write.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/write.rs b/src/write.rs index ee7b1d7..e0dd9d6 100644 --- a/src/write.rs +++ b/src/write.rs @@ -202,13 +202,7 @@ impl Report<'_, S> { }; let line_range = src.get_line_range(char_span); - Some( - (1..) - .map(|x| 10u32.pow(x)) - .take_while(|x| line_range.end as u32 / x != 0) - .count() - + 1, - ) + Some(nb_digits(line_range.end)) }, ) .max() @@ -919,6 +913,11 @@ impl Report<'_, S> { } } +/// Returns how many digits it takes to print `value`. +fn nb_digits(value: usize) -> usize { + value.checked_ilog10().unwrap_or(0) as usize + 1 +} + #[cfg(test)] mod tests { //! These tests use [insta](https://insta.rs/). If you do `cargo install cargo-insta` you can From 59790f3ae296e367caeb1c50e2f666223c9f071f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 12:06:14 +0200 Subject: [PATCH 03/38] Dedicate a struct name to repeating chars This makes its purpose clearer, and also removes one pair of parens --- src/display.rs | 9 ++++++--- src/write.rs | 14 +++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/display.rs b/src/display.rs index d074009..9e39047 100644 --- a/src/display.rs +++ b/src/display.rs @@ -21,10 +21,13 @@ impl<'a, T, F: Fn(&mut fmt::Formatter, &'a T) -> fmt::Result> Display for Show<( } } -impl Display for Show<(T, usize)> { +#[derive(Copy, Clone, Debug)] +pub struct Rept(pub T, pub usize); + +impl Display for Rept { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for _ in 0..self.0 .1 { - write!(f, "{}", self.0 .0)?; + for _ in 0..self.1 { + write!(f, "{}", self.0)?; } Ok(()) } diff --git a/src/write.rs b/src/write.rs index e0dd9d6..bb3fd69 100644 --- a/src/write.rs +++ b/src/write.rs @@ -4,7 +4,7 @@ use std::ops::Range; use crate::{IndexType, LabelDisplay}; use super::draw::{self, StreamAwareFmt, StreamType}; -use super::{Cache, CharSet, LabelAttach, Report, ReportKind, Show, Span, Write}; +use super::{Cache, CharSet, LabelAttach, Report, ReportKind, Rept, Show, Span, Write}; // A WARNING, FOR ALL YE WHO VENTURE IN HERE // @@ -262,7 +262,7 @@ impl Report<'_, S> { writeln!( w, "{}{}{}{} {} {}", - Show((' ', line_no_width + 2)), + Rept(' ', line_no_width + 2), if group_idx == 0 { draw.ltop } else { @@ -279,7 +279,7 @@ impl Report<'_, S> { writeln!( w, "{}{}", - Show((' ', line_no_width + 2)), + Rept(' ', line_no_width + 2), draw.vbar.fg(self.config.margin_color(), s) )?; } @@ -320,7 +320,7 @@ impl Report<'_, S> { let line_no = format!("{}", idx + 1); format!( "{}{} {}", - Show((' ', line_no_width - line_no.chars().count())), + Rept(' ', line_no_width - line_no.chars().count()), line_no, draw.vbar, ) @@ -328,7 +328,7 @@ impl Report<'_, S> { } else { format!( "{}{}", - Show((' ', line_no_width + 1)), + Rept(' ', line_no_width + 1), if is_ellipsis { draw.vbar_gap } else { @@ -897,13 +897,13 @@ impl Report<'_, S> { if !self.config.compact { if is_final_group { let final_margin = - format!("{}{}", Show((draw.hbar, line_no_width + 2)), draw.rbot); + format!("{}{}", Rept(draw.hbar, line_no_width + 2), draw.rbot); writeln!(w, "{}", final_margin.fg(self.config.margin_color(), s))?; } else { writeln!( w, "{}{}", - Show((' ', line_no_width + 2)), + Rept(' ', line_no_width + 2), draw.vbar.fg(self.config.margin_color(), s) )?; } From da3e437bfd735c3fcfeef71c3b74c99d3aae8664 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 12:18:02 +0200 Subject: [PATCH 04/38] Make obtaining its colour a method of `ReportKind` Makes sense to have that logic next to the `Display` impl, IMO --- src/lib.rs | 11 +++++++++++ src/write.rs | 9 ++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ededa5f..7457706 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,6 +267,17 @@ pub enum ReportKind<'a> { Custom(&'a str, Color), } +impl ReportKind<'_> { + fn color(&self, config: &Config) -> Option { + match self { + ReportKind::Error => config.error_color(), + ReportKind::Warning => config.warning_color(), + ReportKind::Advice => config.advice_color(), + ReportKind::Custom(_, color) => Some(*color), + } + } +} + impl fmt::Display for ReportKind<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { diff --git a/src/write.rs b/src/write.rs index bb3fd69..2539855 100644 --- a/src/write.rs +++ b/src/write.rs @@ -4,7 +4,7 @@ use std::ops::Range; use crate::{IndexType, LabelDisplay}; use super::draw::{self, StreamAwareFmt, StreamType}; -use super::{Cache, CharSet, LabelAttach, Report, ReportKind, Rept, Show, Span, Write}; +use super::{Cache, CharSet, LabelAttach, Report, Rept, Show, Span, Write}; // A WARNING, FOR ALL YE WHO VENTURE IN HERE // @@ -171,12 +171,7 @@ impl Report<'_, S> { let code = self.code.as_ref().map(|c| format!("[{}] ", c)); let id = format!("{}{}:", Show(code), self.kind); - let kind_color = match self.kind { - ReportKind::Error => self.config.error_color(), - ReportKind::Warning => self.config.warning_color(), - ReportKind::Advice => self.config.advice_color(), - ReportKind::Custom(_, color) => Some(color), - }; + let kind_color = self.kind.color(&self.config); writeln!(w, "{} {}", id.fg(kind_color, s), Show(self.msg.as_ref()))?; let groups = self.get_source_groups(&mut cache); From e215cc6103c7b7479c1775cedfd18ebaee82017a Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 12:42:43 +0200 Subject: [PATCH 05/38] Factor out a `fecth_source` function This ensures only a single copy of the error message exists, and outlines yet more code outside of the massive `write_for_stream` function. --- src/write.rs | 55 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/write.rs b/src/write.rs index 2539855..8728c06 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1,7 +1,7 @@ use std::io; use std::ops::Range; -use crate::{IndexType, LabelDisplay}; +use crate::{IndexType, LabelDisplay, Source}; use super::draw::{self, StreamAwareFmt, StreamType}; use super::{Cache, CharSet, LabelAttach, Report, Rept, Show, Span, Write}; @@ -183,21 +183,10 @@ impl Report<'_, S> { |SourceGroup { char_span, src_id, .. }| { - let src_name = cache - .display(src_id) - .map(|d| d.to_string()) - .unwrap_or_else(|| "".to_string()); - - let src = match cache.fetch(src_id) { - Ok(src) => src, - Err(e) => { - eprintln!("Unable to fetch source {}: {:?}", src_name, e); - return None; - } - }; - - let line_range = src.get_line_range(char_span); - Some(nb_digits(line_range.end)) + fetch_source(&mut cache, src_id).map(|(src, _)| { + let line_range = src.get_line_range(char_span); + nb_digits(line_range.end) + }) }, ) .max() @@ -214,17 +203,8 @@ impl Report<'_, S> { }, ) in groups.into_iter().enumerate() { - let src_name = cache - .display(src_id) - .map(|d| d.to_string()) - .unwrap_or_else(|| "".to_string()); - - let src = match cache.fetch(src_id) { - Ok(src) => src, - Err(e) => { - eprintln!("Unable to fetch source {}: {:?}", src_name, e); - continue; - } + let Some((src, src_name)) = fetch_source(&mut cache, src_id) else { + continue; }; let line_range = src.get_line_range(&char_span); @@ -908,6 +888,27 @@ impl Report<'_, S> { } } +fn fetch_source<'a, Id: ?Sized, C: Cache>( + cache: &'a mut C, + src_id: &Id, +) -> Option<(&'a Source, String)> { + let src_name = display_name(cache, src_id); + match cache.fetch(src_id) { + Ok(src) => Some((src, src_name)), + Err(e) => { + eprintln!("Unable to fetch source {}: {:?}", src_name, e); + None + } + } +} + +fn display_name>(cache: &C, src_id: &Id) -> String { + cache + .display(src_id) + .map(|d| d.to_string()) + .unwrap_or_else(|| "".to_string()) +} + /// Returns how many digits it takes to print `value`. fn nb_digits(value: usize) -> usize { value.checked_ilog10().unwrap_or(0) as usize + 1 From 8ba9c61f3087e0bb1d57dcb3b8458ad06267a18f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 12:50:04 +0200 Subject: [PATCH 06/38] Use `bool::then_some` to simplify a few exprs --- src/write.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/write.rs b/src/write.rs index 8728c06..ccb539f 100644 --- a/src/write.rs +++ b/src/write.rs @@ -317,7 +317,7 @@ impl Report<'_, S> { w, " {}{}", line_no_margin, - Show(Some(' ').filter(|_| !self.config.compact)), + Show((!self.config.compact).then_some(' ')), )?; // Multi-line margins @@ -352,7 +352,7 @@ impl Report<'_, S> { if let Some(margin) = margin.filter(|_| is_line) { margin_ptr = Some((margin, is_start)); } else if !is_start && (!is_end || is_line) { - vbar = vbar.or(Some(*label).filter(|_| !is_parent)); + vbar = vbar.or((!is_parent).then_some(*label)); } else if let Some((report_row, is_arrow)) = report_row { let label_row = line_labels .iter() @@ -361,7 +361,7 @@ impl Report<'_, S> { .map_or(0, |(r, _)| r); if report_row == label_row { if let Some(margin) = margin { - vbar = Some(margin.label).filter(|_| col == i); + vbar = (col == i).then_some(margin.label); if is_start { continue; } @@ -373,12 +373,12 @@ impl Report<'_, S> { corner = Some((label, is_start)); } } else if !is_start { - vbar = vbar.or(Some(*label).filter(|_| !is_parent)); + vbar = vbar.or((!is_parent).then_some(*label)); } } else { - vbar = vbar.or(Some(*label).filter(|_| { - !is_parent && (is_start ^ (report_row < label_row)) - })); + vbar = vbar.or((!is_parent + && (is_start ^ (report_row < label_row))) + .then_some(*label)); } } } From 9ea9f7784caa8485e79d96094b0c5dc1dee97e17 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 12:53:41 +0200 Subject: [PATCH 07/38] Remove dead `impl Display for Show` --- src/display.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/display.rs b/src/display.rs index 9e39047..4372eb9 100644 --- a/src/display.rs +++ b/src/display.rs @@ -12,15 +12,6 @@ impl Display for Show> { } } -impl<'a, T, F: Fn(&mut fmt::Formatter, &'a T) -> fmt::Result> Display for Show<(&'a [T], F)> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - for x in self.0 .0 { - (self.0 .1)(f, x)?; - } - Ok(()) - } -} - #[derive(Copy, Clone, Debug)] pub struct Rept(pub T, pub usize); From 07ceb6b7c57baad0e3c8212939e07008e48c74cd Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 13:02:21 +0200 Subject: [PATCH 08/38] Mark `Show` and `Rept` as crate-local This improves dead code analysis --- src/display.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.rs b/src/display.rs index 4372eb9..3c2496c 100644 --- a/src/display.rs +++ b/src/display.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone, Debug)] -pub struct Show(pub T); +pub(crate) struct Show(pub T); impl Display for Show> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -13,7 +13,7 @@ impl Display for Show> { } #[derive(Copy, Clone, Debug)] -pub struct Rept(pub T, pub usize); +pub(crate) struct Rept(pub T, pub usize); impl Display for Rept { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { From 465e3d6ceaa5ac05e2ded7b984dd08781e46ead9 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 13:02:43 +0200 Subject: [PATCH 09/38] Simplify computation of line numbers a bit Just deflating the line count a bit --- src/write.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/write.rs b/src/write.rs index ccb539f..08c7d88 100644 --- a/src/write.rs +++ b/src/write.rs @@ -179,16 +179,12 @@ impl Report<'_, S> { // Line number maximum width let line_no_width = groups .iter() - .filter_map( - |SourceGroup { - char_span, src_id, .. - }| { - fetch_source(&mut cache, src_id).map(|(src, _)| { - let line_range = src.get_line_range(char_span); - nb_digits(line_range.end) - }) - }, - ) + .filter_map(|group| { + fetch_source(&mut cache, group.src_id).map(|(src, _)| { + let line_range = src.get_line_range(&group.char_span); + nb_digits(line_range.end) + }) + }) .max() .unwrap_or(0); From 4d332848de28e0adc64c6ac128de51449af8dd97 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 13:09:05 +0200 Subject: [PATCH 10/38] Use `fetch_source` in `Report::get_source_groups` as well Missed it, because that one didn't have the `` fallback. Introducing it should improve consistency a bit. --- src/write.rs | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/write.rs b/src/write.rs index 08c7d88..0ef366e 100644 --- a/src/write.rs +++ b/src/write.rs @@ -46,13 +46,8 @@ impl Report<'_, S> { for label in self.labels.iter() { let label_source = label.span.source(); - let src_display = cache.display(label_source); - let src = match cache.fetch(label_source) { - Ok(src) => src, - Err(e) => { - eprintln!("Unable to fetch source '{}': {:?}", Show(src_display), e); - continue; - } + let Some((src, _)) = fetch_source(cache, label_source) else { + continue; }; let given_label_span = label.span.start()..label.span.end(); @@ -190,26 +185,18 @@ impl Report<'_, S> { // --- Source sections --- let groups_len = groups.len(); - for ( - group_idx, - SourceGroup { - src_id, - char_span, - labels, - }, - ) in groups.into_iter().enumerate() - { - let Some((src, src_name)) = fetch_source(&mut cache, src_id) else { + for (group_idx, group) in groups.into_iter().enumerate() { + let Some((src, src_name)) = fetch_source(&mut cache, group.src_id) else { continue; }; - let line_range = src.get_line_range(&char_span); + let line_range = src.get_line_range(&group.char_span); // File name & reference - let location = if src_id == self.span.source() { + let location = if group.src_id == self.span.source() { self.span.start() } else { - labels[0].char_span.start + group.labels[0].char_span.start }; let line_and_col = match self.config.index_type { IndexType::Char => src.get_offset_line(location), @@ -265,7 +252,7 @@ impl Report<'_, S> { // Generate a list of multi-line labels let mut multi_labels = Vec::new(); let mut multi_labels_with_message = Vec::new(); - for label_info in &labels { + for label_info in &group.labels { if matches!(label_info.kind, LabelKind::Multiline) { multi_labels.push(label_info); if label_info.display_info.msg.is_some() { @@ -524,7 +511,7 @@ impl Report<'_, S> { }) .collect::>(); - for label_info in labels.iter().filter(|l| { + for label_info in group.labels.iter().filter(|l| { l.char_span.start >= line.span().start && l.char_span.end <= line.span().end }) { if matches!(label_info.kind, LabelKind::Inline) { From 7c37877d584a3e54e6d0a5d1cfa5bc38ea6ab133 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 25 May 2024 14:28:42 +0200 Subject: [PATCH 11/38] Factor out a `max_line_no` function Further deflating `write_for_stream`, though it also should improve performance slightly: - The number of digits is only computed for the greatest line number - This is a valid transformation, because the largest line no is also one of the largest --- src/write.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/write.rs b/src/write.rs index 0ef366e..167db77 100644 --- a/src/write.rs +++ b/src/write.rs @@ -172,16 +172,7 @@ impl Report<'_, S> { let groups = self.get_source_groups(&mut cache); // Line number maximum width - let line_no_width = groups - .iter() - .filter_map(|group| { - fetch_source(&mut cache, group.src_id).map(|(src, _)| { - let line_range = src.get_line_range(&group.char_span); - nb_digits(line_range.end) - }) - }) - .max() - .unwrap_or(0); + let line_no_width = max_line_no(&groups, &mut cache).map_or(0, nb_digits); // --- Source sections --- let groups_len = groups.len(); @@ -892,6 +883,21 @@ fn display_name>(cache: &C, src_id: &Id) -> String { .unwrap_or_else(|| "".to_string()) } +fn max_line_no>( + groups: &[SourceGroup<'_, S>], + cache: &mut C, +) -> Option { + groups + .iter() + .filter_map(|group| { + fetch_source(cache, group.src_id).map(|(src, _)| { + let line_range = src.get_line_range(&group.char_span); + line_range.end + }) + }) + .max() +} + /// Returns how many digits it takes to print `value`. fn nb_digits(value: usize) -> usize { value.checked_ilog10().unwrap_or(0) as usize + 1 From 9b3a0437b120ae70de93b753c5b90b350a79696d Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 27 May 2024 23:00:15 +0200 Subject: [PATCH 12/38] Force `Show` to only contain an `Option` Making its purpose clearer. --- src/display.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.rs b/src/display.rs index 3c2496c..5cfd181 100644 --- a/src/display.rs +++ b/src/display.rs @@ -1,9 +1,9 @@ use std::fmt::{self, Display}; #[derive(Copy, Clone, Debug)] -pub(crate) struct Show(pub T); +pub(crate) struct Show(pub Option); -impl Display for Show> { +impl Display for Show { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &self.0 { Some(x) => write!(f, "{}", x), From d199caa22bbe36fbd560be6efa47c5f94f102b61 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 27 May 2024 23:17:03 +0200 Subject: [PATCH 13/38] Use more compact print!/write! syntax In the hopes of making the function a little shorter --- src/display.rs | 2 +- src/lib.rs | 2 +- src/write.rs | 34 +++++++++++++--------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/display.rs b/src/display.rs index 5cfd181..d37a015 100644 --- a/src/display.rs +++ b/src/display.rs @@ -6,7 +6,7 @@ pub(crate) struct Show(pub Option); impl Display for Show { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &self.0 { - Some(x) => write!(f, "{}", x), + Some(x) => write!(f, "{x}"), None => Ok(()), } } diff --git a/src/lib.rs b/src/lib.rs index 7457706..130612f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -284,7 +284,7 @@ impl fmt::Display for ReportKind<'_> { ReportKind::Error => write!(f, "Error"), ReportKind::Warning => write!(f, "Warning"), ReportKind::Advice => write!(f, "Advice"), - ReportKind::Custom(s, _) => write!(f, "{}", s), + ReportKind::Custom(s, _) => write!(f, "{s}"), } } } diff --git a/src/write.rs b/src/write.rs index 167db77..d56e37c 100644 --- a/src/write.rs +++ b/src/write.rs @@ -164,7 +164,7 @@ impl Report<'_, S> { // --- Header --- - let code = self.code.as_ref().map(|c| format!("[{}] ", c)); + let code = self.code.as_ref().map(|c| format!("[{c}] ")); let id = format!("{}{}:", Show(code), self.kind); let kind_color = self.kind.color(&self.config); writeln!(w, "{} {}", id.fg(kind_color, s), Show(self.msg.as_ref()))?; @@ -210,7 +210,7 @@ impl Report<'_, S> { let line_ref = format!("{}:{}:{}", src_name, line_no, col_no); writeln!( w, - "{}{}{}{} {} {}", + "{}{}{}{} {line_ref} {}", Rept(' ', line_no_width + 2), if group_idx == 0 { draw.ltop @@ -220,7 +220,6 @@ impl Report<'_, S> { .fg(self.config.margin_color(), s), draw.hbar.fg(self.config.margin_color(), s), draw.lbox.fg(self.config.margin_color(), s), - line_ref, draw.rbox.fg(self.config.margin_color(), s), )?; @@ -268,9 +267,8 @@ impl Report<'_, S> { let line_no_margin = if is_line && !is_ellipsis { let line_no = format!("{}", idx + 1); format!( - "{}{} {}", + "{}{line_no} {}", Rept(' ', line_no_width - line_no.chars().count()), - line_no, draw.vbar, ) .fg(self.config.margin_color(), s) @@ -289,8 +287,7 @@ impl Report<'_, S> { write!( w, - " {}{}", - line_no_margin, + " {line_no_margin}{}", Show((!self.config.compact).then_some(' ')), )?; @@ -425,9 +422,9 @@ impl Report<'_, S> { } else { (' '.fg(None, s), ' '.fg(None, s)) }; - write!(w, "{}", a)?; + write!(w, "{a}")?; if !self.config.compact { - write!(w, "{}", b)?; + write!(w, "{b}")?; } } } @@ -783,10 +780,10 @@ impl Report<'_, S> { }; if width > 0 { - write!(w, "{}", c)?; + write!(w, "{c}")?; } for _ in 1..width { - write!(w, "{}", tail)?; + write!(w, "{tail}")?; } } if line_label.draw_msg { @@ -805,7 +802,7 @@ impl Report<'_, S> { writeln!(w)?; } write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; - writeln!(w, "{}: {}", "Help".fg(self.config.note_color(), s), note)?; + writeln!(w, "{}: {note}", "Help".fg(self.config.note_color(), s))?; } // Note @@ -825,19 +822,14 @@ impl Report<'_, S> { if let Some(line) = lines.next() { write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; if self.notes.len() > 1 { - writeln!( - w, - "{}: {}", - note_prefix.fg(self.config.note_color(), s), - line - )?; + writeln!(w, "{}: {line}", note_prefix.fg(self.config.note_color(), s),)?; } else { - writeln!(w, "{}: {}", "Note".fg(self.config.note_color(), s), line)?; + writeln!(w, "{}: {line}", "Note".fg(self.config.note_color(), s))?; } } for line in lines { write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; - writeln!(w, "{:>pad$}{}", "", line, pad = note_prefix_len + 2)?; + writeln!(w, "{:>pad$}{line}", "", pad = note_prefix_len + 2)?; } } } @@ -870,7 +862,7 @@ fn fetch_source<'a, Id: ?Sized, C: Cache>( match cache.fetch(src_id) { Ok(src) => Some((src, src_name)), Err(e) => { - eprintln!("Unable to fetch source {}: {:?}", src_name, e); + eprintln!("Unable to fetch source {src_name}: {e:?}"); None } } From c98d4f694737b9ca5fd0ead72e4941fc28b5c8d2 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 27 May 2024 23:25:32 +0200 Subject: [PATCH 14/38] Use the `format!` padding feature to pad out line numbers This is more compact, and it might be cheaper too! --- src/draw.rs | 8 ++++++++ src/write.rs | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/draw.rs b/src/draw.rs index d732dec..0ec9124 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -76,6 +76,14 @@ impl Characters { underline: '^', } } + + pub(crate) fn vbar(&self, is_gap: bool) -> char { + if is_gap { + self.vbar_gap + } else { + self.vbar + } + } } /// Output stream to check for whether color is enabled. diff --git a/src/write.rs b/src/write.rs index d56e37c..7f39ce5 100644 --- a/src/write.rs +++ b/src/write.rs @@ -265,13 +265,8 @@ impl Report<'_, S> { margin_label: &Option| -> std::io::Result<()> { let line_no_margin = if is_line && !is_ellipsis { - let line_no = format!("{}", idx + 1); - format!( - "{}{line_no} {}", - Rept(' ', line_no_width - line_no.chars().count()), - draw.vbar, - ) - .fg(self.config.margin_color(), s) + format!("{:line_no_width$} {}", idx + 1, draw.vbar) + .fg(self.config.margin_color(), s) } else { format!( "{}{}", From 67215dc199c0654598ffcbdca51aa342c4d2bd8d Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 27 May 2024 23:27:19 +0200 Subject: [PATCH 15/38] Factor out a function to obtain the appropriate `vbar` --- src/write.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/write.rs b/src/write.rs index 7f39ce5..69b5591 100644 --- a/src/write.rs +++ b/src/write.rs @@ -268,16 +268,8 @@ impl Report<'_, S> { format!("{:line_no_width$} {}", idx + 1, draw.vbar) .fg(self.config.margin_color(), s) } else { - format!( - "{}{}", - Rept(' ', line_no_width + 1), - if is_ellipsis { - draw.vbar_gap - } else { - draw.vbar - } - ) - .fg(self.config.skipped_margin_color(), s) + format!("{}{}", Rept(' ', line_no_width + 1), draw.vbar(is_ellipsis)) + .fg(self.config.skipped_margin_color(), s) }; write!( @@ -386,12 +378,7 @@ impl Report<'_, S> { ) } else if let Some(label) = vbar { ( - if is_ellipsis { - draw.vbar_gap - } else { - draw.vbar - } - .fg(label.display_info.color, s), + draw.vbar(is_ellipsis).fg(label.display_info.color, s), ' '.fg(None, s), ) } else if let (Some((margin, is_start)), true) = (margin_ptr, is_line) { From a2f5b691b41821cc2cae2efe521e59a9a529a8a2 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 27 May 2024 23:35:20 +0200 Subject: [PATCH 16/38] Use a slightly more descriptive name for `is_line` --- src/write.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/write.rs b/src/write.rs index 69b5591..21c1df1 100644 --- a/src/write.rs +++ b/src/write.rs @@ -257,14 +257,14 @@ impl Report<'_, S> { let write_margin = |w: &mut W, idx: usize, - is_line: bool, + is_src_line: bool, is_ellipsis: bool, draw_labels: bool, report_row: Option<(usize, bool)>, line_labels: &[LineLabel], margin_label: &Option| -> std::io::Result<()> { - let line_no_margin = if is_line && !is_ellipsis { + let line_no_margin = if is_src_line && !is_ellipsis { format!("{:line_no_width$} {}", idx + 1, draw.vbar) .fg(self.config.margin_color(), s) } else { @@ -307,9 +307,9 @@ impl Report<'_, S> { let is_start = line_span.contains(&label.char_span.start); let is_end = line_span.contains(&label.last_offset()); - if let Some(margin) = margin.filter(|_| is_line) { + if let Some(margin) = margin.filter(|_| is_src_line) { margin_ptr = Some((margin, is_start)); - } else if !is_start && (!is_end || is_line) { + } else if !is_start && (!is_end || is_src_line) { vbar = vbar.or((!is_parent).then_some(*label)); } else if let Some((report_row, is_arrow)) = report_row { let label_row = line_labels @@ -342,7 +342,7 @@ impl Report<'_, S> { } } - if let (Some((margin, _is_start)), true) = (margin_ptr, is_line) { + if let (Some((margin, _is_start)), true) = (margin_ptr, is_src_line) { let is_col = multi_label.map_or(false, |ml| std::ptr::eq(*ml, margin.label)); let is_limit = col + 1 == multi_labels_with_message.len(); @@ -355,7 +355,7 @@ impl Report<'_, S> { margin_label .as_ref() .map_or(true, |margin| !std::ptr::eq(margin.label, *l)) - || !is_line + || !is_src_line }); let (a, b) = if let Some((label, is_start)) = corner { @@ -381,7 +381,7 @@ impl Report<'_, S> { draw.vbar(is_ellipsis).fg(label.display_info.color, s), ' '.fg(None, s), ) - } else if let (Some((margin, is_start)), true) = (margin_ptr, is_line) { + } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { let is_col = multi_label.map_or(false, |ml| std::ptr::eq(*ml, margin.label)); let is_limit = col == multi_labels_with_message.len(); From 638c80c6401a5b104bc8703fd31c9cbfe731c294 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 28 May 2024 14:49:21 +0200 Subject: [PATCH 17/38] [BREAKING] Factor out a `Location` struct to group that info The field names are more expressive than a tuple --- src/source.rs | 29 +++++++++++--- src/write.rs | 106 +++++++++++++++++++++++++++++++------------------- 2 files changed, 88 insertions(+), 47 deletions(-) diff --git a/src/source.rs b/src/source.rs index eb0b8c3..ab22b9f 100644 --- a/src/source.rs +++ b/src/source.rs @@ -209,7 +209,7 @@ impl> Source { /// Get the line that the given offset appears on, and the line/column numbers of the offset. /// /// Note that the line/column numbers are zero-indexed. - pub fn get_offset_line(&self, offset: usize) -> Option<(Line, usize, usize)> { + pub fn get_offset_line(&self, offset: usize) -> Option { if offset <= self.len { let idx = self .lines @@ -222,7 +222,11 @@ impl> Source { offset, line.offset ); - Some((line, idx, offset - line.offset)) + Some(Location { + line, + line_idx: idx, + col_idx: offset - line.offset, + }) } else { None } @@ -231,7 +235,7 @@ impl> Source { /// Get the line that the given byte offset appears on, and the line/byte column numbers of the offset. /// /// Note that the line/column numbers are zero-indexed. - pub fn get_byte_line(&self, byte_offset: usize) -> Option<(Line, usize, usize)> { + pub fn get_byte_line(&self, byte_offset: usize) -> Option { if byte_offset <= self.byte_len { let idx = self .lines @@ -244,7 +248,11 @@ impl> Source { byte_offset, line.byte_offset ); - Some((line, idx, byte_offset - line.byte_offset)) + Some(Location { + line, + line_idx: idx, + col_idx: byte_offset - line.byte_offset, + }) } else { None } @@ -255,10 +263,12 @@ impl> Source { /// The resulting range is guaranteed to contain valid line indices (i.e: those that can be used for /// [`Source::line`]). pub fn get_line_range(&self, span: &S) -> Range { - let start = self.get_offset_line(span.start()).map_or(0, |(_, l, _)| l); + let start = self + .get_offset_line(span.start()) + .map_or(0, |location| location.line_idx); let end = self .get_offset_line(span.end().saturating_sub(1).max(span.start())) - .map_or(self.lines.len(), |(_, l, _)| l + 1); + .map_or(self.lines.len(), |location| location.line_idx + 1); start..end } @@ -268,6 +278,13 @@ impl> Source { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Location { + pub line: Line, + pub line_idx: usize, + pub col_idx: usize, +} + impl> Cache<()> for Source { type Storage = I; diff --git a/src/write.rs b/src/write.rs index 21c1df1..9a228f2 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1,6 +1,8 @@ +use std::fmt::Display; use std::io; use std::ops::Range; +use crate::source::Location; use crate::{IndexType, LabelDisplay, Source}; use super::draw::{self, StreamAwareFmt, StreamType}; @@ -58,45 +60,50 @@ impl Report<'_, S> { continue; }; let end_line = if given_label_span.start >= given_label_span.end { - start_line.1 + start_line.line_idx } else { let Some(end_line) = src.get_offset_line(given_label_span.end - 1) else { continue; }; - end_line.1 + end_line.line_idx }; - (given_label_span, start_line.1, end_line) + (given_label_span, start_line.line_idx, end_line) } IndexType::Byte => { - let Some((start_line_obj, start_line, start_byte_col)) = - src.get_byte_line(given_label_span.start) - else { + let Some(start_location) = src.get_byte_line(given_label_span.start) else { continue; }; - let line_text = src.get_line_text(start_line_obj).unwrap(); + let line_text = src.get_line_text(start_location.line).unwrap(); - let num_chars_before_start = line_text[..start_byte_col.min(line_text.len())] + let num_chars_before_start = line_text + [..start_location.col_idx.min(line_text.len())] .chars() .count(); - let start_char_offset = start_line_obj.offset() + num_chars_before_start; + let start_char_offset = start_location.line.offset() + num_chars_before_start; if given_label_span.start >= given_label_span.end { - (start_char_offset..start_char_offset, start_line, start_line) + ( + start_char_offset..start_char_offset, + start_location.line_idx, + start_location.line_idx, + ) } else { // We can subtract 1 from end, because get_byte_line doesn't actually index into the text. let end_pos = given_label_span.end - 1; - let Some((end_line_obj, end_line, end_byte_col)) = - src.get_byte_line(end_pos) - else { + let Some(end_location) = src.get_byte_line(end_pos) else { continue; }; - let end_line_text = src.get_line_text(end_line_obj).unwrap(); + let end_line_text = src.get_line_text(end_location.line).unwrap(); // Have to add 1 back now, so we don't cut a char in two. let num_chars_before_end = - end_line_text[..end_byte_col + 1].chars().count(); - let end_char_offset = end_line_obj.offset() + num_chars_before_end; - - (start_char_offset..end_char_offset, start_line, end_line) + end_line_text[..end_location.col_idx + 1].chars().count(); + let end_char_offset = end_location.line.offset() + num_chars_before_end; + + ( + start_char_offset..end_char_offset, + start_location.line_idx, + end_location.line_idx, + ) } } }; @@ -189,28 +196,29 @@ impl Report<'_, S> { } else { group.labels[0].char_span.start }; - let line_and_col = match self.config.index_type { - IndexType::Char => src.get_offset_line(location), - IndexType::Byte => src.get_byte_line(location).map(|(line_obj, idx, col)| { - let line_text = src.get_line_text(line_obj).unwrap(); - - let col = line_text[..col.min(line_text.len())].chars().count(); - - (line_obj, idx, col) - }), - }; - let (line_no, col_no) = line_and_col - .map(|(_, idx, col)| { - ( - format!("{}", idx + 1 + src.display_line_offset()), - format!("{}", col + 1), - ) - }) - .unwrap_or_else(|| ('?'.to_string(), '?'.to_string())); - let line_ref = format!("{}:{}:{}", src_name, line_no, col_no); + let location = Loc( + src, + src_name, + match self.config.index_type { + IndexType::Char => src.get_offset_line(location), + IndexType::Byte => src.get_byte_line(location).map(|location| { + let line_text = src.get_line_text(location.line).unwrap(); + + let col = line_text[..location.col_idx.min(line_text.len())] + .chars() + .count(); + + Location { + line: location.line, + line_idx: location.line_idx, + col_idx: col, + } + }), + }, + ); writeln!( w, - "{}{}{}{} {line_ref} {}", + "{}{}{}{} {location} {}", Rept(' ', line_no_width + 2), if group_idx == 0 { draw.ltop @@ -416,9 +424,7 @@ impl Report<'_, S> { let mut is_ellipsis = false; for idx in line_range { - let line = if let Some(line) = src.line(idx) { - line - } else { + let Some(line) = src.line(idx) else { continue; }; @@ -877,6 +883,24 @@ fn nb_digits(value: usize) -> usize { value.checked_ilog10().unwrap_or(0) as usize + 1 } +#[derive(Debug, Clone)] +struct Loc<'src, I: AsRef>(&'src Source, String, Option); + +impl> Display for Loc<'_, I> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self.2.as_ref() { + Some(location) => write!( + f, + "{}:{}:{}", + self.1, + location.line_idx + 1 + self.0.display_line_offset(), + location.col_idx + 1 + ), + None => write!(f, ":?:?"), + } + } +} + #[cfg(test)] mod tests { //! These tests use [insta](https://insta.rs/). If you do `cargo install cargo-insta` you can From 992c9f39baf718a125b9eb7e36d0a5ef7a9543a9 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 28 May 2024 20:13:19 +0200 Subject: [PATCH 18/38] Factor out a separate function for `group_connector` To determine what goes to the left of a "source group" designation --- src/draw.rs | 8 ++++++++ src/write.rs | 34 +++++++++++++++++----------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/draw.rs b/src/draw.rs index 0ec9124..d083443 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -84,6 +84,14 @@ impl Characters { self.vbar } } + + pub(crate) fn group_connector(&self, is_first_group: bool) -> char { + if is_first_group { + self.ltop + } else { + self.lcross + } + } } /// Output stream to check for whether color is enabled. diff --git a/src/write.rs b/src/write.rs index 9a228f2..526753c 100644 --- a/src/write.rs +++ b/src/write.rs @@ -179,7 +179,7 @@ impl Report<'_, S> { let groups = self.get_source_groups(&mut cache); // Line number maximum width - let line_no_width = max_line_no(&groups, &mut cache).map_or(0, nb_digits); + let line_num_width = max_line_num(&groups, &mut cache).map_or(0, nb_digits); // --- Source sections --- let groups_len = groups.len(); @@ -219,13 +219,9 @@ impl Report<'_, S> { writeln!( w, "{}{}{}{} {location} {}", - Rept(' ', line_no_width + 2), - if group_idx == 0 { - draw.ltop - } else { - draw.lcross - } - .fg(self.config.margin_color(), s), + Rept(' ', line_num_width + 2), + draw.group_connector(group_idx == 0) + .fg(self.config.margin_color(), s), draw.hbar.fg(self.config.margin_color(), s), draw.lbox.fg(self.config.margin_color(), s), draw.rbox.fg(self.config.margin_color(), s), @@ -235,7 +231,7 @@ impl Report<'_, S> { writeln!( w, "{}{}", - Rept(' ', line_no_width + 2), + Rept(' ', line_num_width + 2), draw.vbar.fg(self.config.margin_color(), s) )?; } @@ -272,17 +268,21 @@ impl Report<'_, S> { line_labels: &[LineLabel], margin_label: &Option| -> std::io::Result<()> { - let line_no_margin = if is_src_line && !is_ellipsis { - format!("{:line_no_width$} {}", idx + 1, draw.vbar) + let line_num_margin = if is_src_line && !is_ellipsis { + format!("{:line_num_width$} {}", idx + 1, draw.vbar) .fg(self.config.margin_color(), s) } else { - format!("{}{}", Rept(' ', line_no_width + 1), draw.vbar(is_ellipsis)) - .fg(self.config.skipped_margin_color(), s) + format!( + "{}{}", + Rept(' ', line_num_width + 1), + draw.vbar(is_ellipsis) + ) + .fg(self.config.skipped_margin_color(), s) }; write!( w, - " {line_no_margin}{}", + " {line_num_margin}{}", Show((!self.config.compact).then_some(' ')), )?; @@ -826,13 +826,13 @@ impl Report<'_, S> { if !self.config.compact { if is_final_group { let final_margin = - format!("{}{}", Rept(draw.hbar, line_no_width + 2), draw.rbot); + format!("{}{}", Rept(draw.hbar, line_num_width + 2), draw.rbot); writeln!(w, "{}", final_margin.fg(self.config.margin_color(), s))?; } else { writeln!( w, "{}{}", - Rept(' ', line_no_width + 2), + Rept(' ', line_num_width + 2), draw.vbar.fg(self.config.margin_color(), s) )?; } @@ -863,7 +863,7 @@ fn display_name>(cache: &C, src_id: &Id) -> String { .unwrap_or_else(|| "".to_string()) } -fn max_line_no>( +fn max_line_num>( groups: &[SourceGroup<'_, S>], cache: &mut C, ) -> Option { From a50004c5bd2ecf0b55f2ead2180e29028642c41b Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 12:33:02 +0200 Subject: [PATCH 19/38] Factor out a `is_referencing` method It makes the purpose of the pointer comparison clearer and is a little bit more concise. --- src/write.rs | 70 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/write.rs b/src/write.rs index 526753c..a4fed87 100644 --- a/src/write.rs +++ b/src/write.rs @@ -236,13 +236,6 @@ impl Report<'_, S> { )?; } - struct LineLabel<'a> { - col: usize, - label: &'a LabelInfo<'a>, - multi: bool, - draw_msg: bool, - } - // Generate a list of multi-line labels let mut multi_labels = Vec::new(); let mut multi_labels_with_message = Vec::new(); @@ -304,9 +297,7 @@ impl Report<'_, S> { .iter() .enumerate() { - let margin = margin_label - .as_ref() - .filter(|m| std::ptr::eq(*label, m.label)); + let margin = margin_label.as_ref().filter(|m| m.is_referencing(label)); if label.char_span.start <= line_span.end && label.char_span.end > line_span.start @@ -315,7 +306,7 @@ impl Report<'_, S> { let is_start = line_span.contains(&label.char_span.start); let is_end = line_span.contains(&label.last_offset()); - if let Some(margin) = margin.filter(|_| is_src_line) { + if let (Some(margin), true) = (margin, is_src_line) { margin_ptr = Some((margin, is_start)); } else if !is_start && (!is_end || is_src_line) { vbar = vbar.or((!is_parent).then_some(*label)); @@ -323,7 +314,7 @@ impl Report<'_, S> { let label_row = line_labels .iter() .enumerate() - .find(|(_, l)| std::ptr::eq(*label, l.label)) + .find(|(_, l)| l.is_referencing(label)) .map_or(0, |(r, _)| r); if report_row == label_row { if let Some(margin) = margin { @@ -351,8 +342,7 @@ impl Report<'_, S> { } if let (Some((margin, _is_start)), true) = (margin_ptr, is_src_line) { - let is_col = - multi_label.map_or(false, |ml| std::ptr::eq(*ml, margin.label)); + let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); let is_limit = col + 1 == multi_labels_with_message.len(); if !is_col && !is_limit { hbar = hbar.or(Some(margin.label)); @@ -362,7 +352,7 @@ impl Report<'_, S> { hbar = hbar.filter(|l| { margin_label .as_ref() - .map_or(true, |margin| !std::ptr::eq(margin.label, *l)) + .map_or(true, |margin| !margin.is_referencing(l)) || !is_src_line }); @@ -390,8 +380,7 @@ impl Report<'_, S> { ' '.fg(None, s), ) } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { - let is_col = - multi_label.map_or(false, |ml| std::ptr::eq(*ml, margin.label)); + let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); let is_limit = col == multi_labels_with_message.len(); ( if is_limit { @@ -465,7 +454,7 @@ impl Report<'_, S> { if is_start && margin_label .as_ref() - .map_or(true, |m| !std::ptr::eq(*label, m.label)) + .map_or(true, |m| !m.is_referencing(label)) { // TODO: Check to see whether multi is the first on the start line or first on the end line Some(LineLabel { @@ -556,7 +545,7 @@ impl Report<'_, S> { ll.label.display_info.msg.is_some() && margin_label .as_ref() - .map_or(true, |m| !std::ptr::eq(ll.label, m.label)) + .map_or(true, |m| !m.is_referencing(ll.label)) }) .find(|(j, ll)| ll.col == col && row <= *j) .map(|(_, ll)| ll) @@ -725,7 +714,7 @@ impl Report<'_, S> { && line_label.label.display_info.msg.is_some() && margin_label .as_ref() - .map_or(true, |m| !std::ptr::eq(line_label.label, m.label)) + .map_or(true, |m| !m.is_referencing(line_label.label)) { [ if line_label.multi { @@ -842,6 +831,22 @@ impl Report<'_, S> { } } +struct LineLabel<'a> { + col: usize, + label: &'a LabelInfo<'a>, + multi: bool, + draw_msg: bool, +} + +impl LineLabel<'_> { + fn is_referencing(&self, label: &LabelInfo<'_>) -> bool { + // Do they point to the same label? + // Note that we want this, and not to compare the labels themselves, so as to support + // printing the same label twice if we were given that. + std::ptr::eq(self.label, label) + } +} + fn fetch_source<'a, Id: ?Sized, C: Cache>( cache: &'a mut C, src_id: &Id, @@ -998,6 +1003,31 @@ mod tests { "###); } + #[test] + fn duplicate_label() { + let source = "apple == orange;"; + let msg = remove_trailing( + Report::build(ReportKind::Error, 0..0) + .with_config(no_color_and_ascii()) + .with_message("can't compare apples with oranges") + .with_label(Label::new(0..5).with_message("This is an apple")) + .with_label(Label::new(0..5).with_message("This is an apple")) + .finish() + .write_to_string(Source::from(source)), + ); + assert_snapshot!(msg, @r###" + Error: can't compare apples with oranges + ,-[ :1:1 ] + | + 1 | apple == orange; + | ^^|^^ + | `---- This is an apple + | | + | `---- This is an apple + ---' + "###); + } + #[test] fn multi_byte_chars() { let source = "äpplë == örängë;"; From 12067f08cd8ce70de8439c6ea5e2d95bcdd52477 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 19:52:04 +0200 Subject: [PATCH 20/38] Condense the arrow-character-selection logic Factor out most of the repeated code --- src/write.rs | 57 ++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/write.rs b/src/write.rs index a4fed87..e38c388 100644 --- a/src/write.rs +++ b/src/write.rs @@ -358,52 +358,47 @@ impl Report<'_, S> { let (a, b) = if let Some((label, is_start)) = corner { ( - if is_start { draw.ltop } else { draw.lbot } - .fg(label.display_info.color, s), - draw.hbar.fg(label.display_info.color, s), + Some((if is_start { draw.ltop } else { draw.lbot }, *label)), + Some((draw.hbar, *label)), ) } else if let Some(label) = hbar.filter(|_| vbar.is_some() && !self.config.cross_gap) { - ( - draw.xbar.fg(label.display_info.color, s), - draw.hbar.fg(label.display_info.color, s), - ) + (Some((draw.xbar, label)), Some((draw.hbar, label))) } else if let Some(label) = hbar { - ( - draw.hbar.fg(label.display_info.color, s), - draw.hbar.fg(label.display_info.color, s), - ) + (Some((draw.hbar, label)), Some((draw.hbar, label))) } else if let Some(label) = vbar { - ( - draw.vbar(is_ellipsis).fg(label.display_info.color, s), - ' '.fg(None, s), - ) + (Some((draw.vbar(is_ellipsis), label)), None) } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); let is_limit = col == multi_labels_with_message.len(); ( - if is_limit { - draw.rarrow - } else if is_col { - if is_start { - draw.ltop + Some(( + if is_limit { + draw.rarrow + } else if is_col { + if is_start { + draw.ltop + } else { + draw.lcross + } } else { - draw.lcross - } - } else { - draw.hbar - } - .fg(margin.label.display_info.color, s), - if !is_limit { draw.hbar } else { ' ' } - .fg(margin.label.display_info.color, s), + draw.hbar + }, + margin.label, + )), + Some((if !is_limit { draw.hbar } else { ' ' }, margin.label)), ) } else { - (' '.fg(None, s), ' '.fg(None, s)) + (None, None) + }; + let arrow_char = |opt: Option<(char, &LabelInfo<'_>)>| match opt { + Some((c, label)) => c.fg(label.display_info.color, s), + None => ' '.fg(None, s), }; - write!(w, "{a}")?; + write!(w, "{}", arrow_char(a))?; if !self.config.compact { - write!(w, "{b}")?; + write!(w, "{}", arrow_char(b))?; } } } From e8d370666ec03ff81522a18b0ec82126ddc1cbcb Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 20:04:33 +0200 Subject: [PATCH 21/38] Condense the arrow-char-selection margin logic a bit more Folding together mostly common cases --- src/draw.rs | 8 ++++++++ src/write.rs | 26 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/draw.rs b/src/draw.rs index d083443..21ab83a 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -77,6 +77,14 @@ impl Characters { } } + pub(crate) fn arrow_bend(&self, is_top: bool) -> char { + if is_top { + self.ltop + } else { + self.lbot + } + } + pub(crate) fn vbar(&self, is_gap: bool) -> char { if is_gap { self.vbar_gap diff --git a/src/write.rs b/src/write.rs index e38c388..da4a8da 100644 --- a/src/write.rs +++ b/src/write.rs @@ -350,23 +350,30 @@ impl Report<'_, S> { } hbar = hbar.filter(|l| { - margin_label + !margin_label .as_ref() - .map_or(true, |margin| !margin.is_referencing(l)) + .map_or(false, |margin| margin.is_referencing(l)) || !is_src_line }); let (a, b) = if let Some((label, is_start)) = corner { ( - Some((if is_start { draw.ltop } else { draw.lbot }, *label)), + Some((draw.arrow_bend(is_start), *label)), Some((draw.hbar, *label)), ) - } else if let Some(label) = - hbar.filter(|_| vbar.is_some() && !self.config.cross_gap) - { - (Some((draw.xbar, label)), Some((draw.hbar, label))) } else if let Some(label) = hbar { - (Some((draw.hbar, label)), Some((draw.hbar, label))) + ( + Some(( + if vbar.is_some() && !self.config.cross_gap { + // Crossing with a vertical arrow, and the config allows us to cross them. + draw.xbar + } else { + draw.hbar + }, + label, + )), + Some((draw.hbar, label)), + ) } else if let Some(label) = vbar { (Some((draw.vbar(is_ellipsis), label)), None) } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { @@ -387,11 +394,12 @@ impl Report<'_, S> { }, margin.label, )), - Some((if !is_limit { draw.hbar } else { ' ' }, margin.label)), + Some((if is_limit { ' ' } else { draw.hbar }, margin.label)), ) } else { (None, None) }; + let arrow_char = |opt: Option<(char, &LabelInfo<'_>)>| match opt { Some((c, label)) => c.fg(label.display_info.color, s), None => ' '.fg(None, s), From caada34e32bdf918b51f9c4639549c1c3a0b5af1 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 20:21:16 +0200 Subject: [PATCH 22/38] Tweak collection of multi-line labels Use `collect()` for hopefully better Vec prealloc, derive one of the arrays from the other (since it's a subset of the first), and sort the first array to guarantee that the second one already is. --- src/write.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/write.rs b/src/write.rs index da4a8da..f22bac4 100644 --- a/src/write.rs +++ b/src/write.rs @@ -185,6 +185,7 @@ impl Report<'_, S> { let groups_len = groups.len(); for (group_idx, group) in groups.into_iter().enumerate() { let Some((src, src_name)) = fetch_source(&mut cache, group.src_id) else { + // `fetch_source` should have reported the error. continue; }; @@ -237,20 +238,18 @@ impl Report<'_, S> { } // Generate a list of multi-line labels - let mut multi_labels = Vec::new(); - let mut multi_labels_with_message = Vec::new(); - for label_info in &group.labels { - if matches!(label_info.kind, LabelKind::Multiline) { - multi_labels.push(label_info); - if label_info.display_info.msg.is_some() { - multi_labels_with_message.push(label_info); - } - } - } - - // Sort multiline labels by length - multi_labels.sort_by_key(|m| -(Span::len(&m.char_span) as isize)); - multi_labels_with_message.sort_by_key(|m| -(Span::len(&m.char_span) as isize)); + let mut multi_labels: Vec<_> = group + .labels + .iter() + .filter(|label_info| matches!(label_info.kind, LabelKind::Multiline)) + .collect(); + // Sort them by length; this also ensures that the next array is sorted. + multi_labels.sort_unstable_by_key(|label_info| !Span::len(&label_info.char_span)); + let multi_labels_with_message: Vec<_> = multi_labels + .iter() + .copied() + .filter(|label_info| label_info.display_info.msg.is_some()) + .collect(); let write_margin = |w: &mut W, idx: usize, From f4f5fa251e446ee1745817db2f8432a81571b635 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 20:40:14 +0200 Subject: [PATCH 23/38] Elide one alloc per report emitted `format_args!` is more difficult to use (hence why `code` stays), but avoids allocating a `String` --- src/write.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/write.rs b/src/write.rs index f22bac4..f943a4b 100644 --- a/src/write.rs +++ b/src/write.rs @@ -172,9 +172,13 @@ impl Report<'_, S> { // --- Header --- let code = self.code.as_ref().map(|c| format!("[{c}] ")); - let id = format!("{}{}:", Show(code), self.kind); let kind_color = self.kind.color(&self.config); - writeln!(w, "{} {}", id.fg(kind_color, s), Show(self.msg.as_ref()))?; + writeln!( + w, + "{} {}", + format_args!("{}{}:", Show(code), self.kind).fg(kind_color, s), + Show(self.msg.as_ref()) + )?; let groups = self.get_source_groups(&mut cache); @@ -449,8 +453,7 @@ impl Report<'_, S> { // Generate a list of labels for this line, along with their label columns let mut line_labels = multi_labels_with_message .iter() - .enumerate() - .filter_map(|(_i, label)| { + .filter_map(|label| { let is_start = line.span().contains(&label.char_span.start); let is_end = line.span().contains(&label.last_offset()); if is_start @@ -463,7 +466,7 @@ impl Report<'_, S> { col: label.char_span.start - line.offset(), label, multi: true, - draw_msg: false, // Multi-line spans don;t have their messages drawn at the start + draw_msg: false, // Multi-line spans don't have their messages drawn at the start }) } else if is_end { Some(LineLabel { From 6ca20a6fbab1e605f9615ef2ee9ef296732ecc71 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 20:55:51 +0200 Subject: [PATCH 24/38] Factor out a function for writing margin characters --- src/write.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/write.rs b/src/write.rs index f943a4b..fba0ba1 100644 --- a/src/write.rs +++ b/src/write.rs @@ -185,6 +185,8 @@ impl Report<'_, S> { // Line number maximum width let line_num_width = max_line_num(&groups, &mut cache).map_or(0, nb_digits); + let margin_char = |c: char| c.fg(self.config.margin_color(), s); + // --- Source sections --- let groups_len = groups.len(); for (group_idx, group) in groups.into_iter().enumerate() { @@ -225,11 +227,10 @@ impl Report<'_, S> { w, "{}{}{}{} {location} {}", Rept(' ', line_num_width + 2), - draw.group_connector(group_idx == 0) - .fg(self.config.margin_color(), s), - draw.hbar.fg(self.config.margin_color(), s), - draw.lbox.fg(self.config.margin_color(), s), - draw.rbox.fg(self.config.margin_color(), s), + margin_char(draw.group_connector(group_idx == 0)), + margin_char(draw.hbar), + margin_char(draw.lbox), + margin_char(draw.rbox), )?; if !self.config.compact { @@ -237,7 +238,7 @@ impl Report<'_, S> { w, "{}{}", Rept(' ', line_num_width + 2), - draw.vbar.fg(self.config.margin_color(), s) + margin_char(draw.vbar) )?; } @@ -819,15 +820,18 @@ impl Report<'_, S> { // Tail of report if !self.config.compact { if is_final_group { - let final_margin = - format!("{}{}", Rept(draw.hbar, line_num_width + 2), draw.rbot); - writeln!(w, "{}", final_margin.fg(self.config.margin_color(), s))?; + writeln!( + w, + "{}", + format_args!("{}{}", Rept(draw.hbar, line_num_width + 2), draw.rbot) + .fg(self.config.margin_color(), s) + )?; } else { writeln!( w, "{}{}", Rept(' ', line_num_width + 2), - draw.vbar.fg(self.config.margin_color(), s) + margin_char(draw.vbar) )?; } } From db16ba47c2941099eaf37311a636c010e22c12e3 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 23:14:14 +0200 Subject: [PATCH 25/38] Switch snapshot tests to Unicode It has more character variety, and thus is more likely to show differences that wouldn't be visible in ASCII --- src/write.rs | 496 +++++++++++++++++++++++++-------------------------- 1 file changed, 246 insertions(+), 250 deletions(-) diff --git a/src/write.rs b/src/write.rs index fba0ba1..f4f091e 100644 --- a/src/write.rs +++ b/src/write.rs @@ -938,12 +938,8 @@ mod tests { } } - fn no_color_and_ascii() -> Config { - Config::default() - .with_color(false) - // Using Ascii so that the inline snapshots display correctly - // even with fonts where characters like '┬' take up more space. - .with_char_set(CharSet::Ascii) + fn no_color() -> Config { + Config::default().with_color(false) } fn remove_trailing(s: String) -> String { @@ -954,7 +950,7 @@ mod tests { fn one_message() { let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .finish() .write_to_string(Source::from("")), @@ -969,7 +965,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5)) .with_label(Label::new(9..15)) @@ -977,13 +973,13 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if these spans still showed up (like codespan-reporting does) - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + ───╯ + "); } #[test] @@ -991,7 +987,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label(Label::new(9..15).with_message("This is an orange")) @@ -999,17 +995,17 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if these lines didn't cross - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ ^^^|^^ - | `-------------- This is an apple - | | - | `---- This is an orange - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + ───╯ + "); } #[test] @@ -1017,7 +1013,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label(Label::new(0..5).with_message("This is an apple")) @@ -1026,14 +1022,14 @@ mod tests { ); assert_snapshot!(msg, @r###" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ - | `---- This is an apple - | | - | `---- This is an apple - ---' + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── + │ ╰──── This is an apple + │ │ + │ ╰──── This is an apple + ───╯ "###); } @@ -1042,7 +1038,7 @@ mod tests { let source = "äpplë == örängë;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii().with_index_type(IndexType::Char)) + .with_config(no_color().with_index_type(IndexType::Char)) .with_message("can't compare äpplës with örängës") .with_label(Label::new(0..5).with_message("This is an äpplë")) .with_label(Label::new(9..15).with_message("This is an örängë")) @@ -1050,17 +1046,17 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if these lines didn't cross - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare äpplës with örängës - ,-[ :1:1 ] - | - 1 | äpplë == örängë; - | ^^|^^ ^^^|^^ - | `-------------- This is an äpplë - | | - | `---- This is an örängë - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ äpplë == örängë; + │ ──┬── ───┬── + │ ╰────────────── This is an äpplë + │ │ + │ ╰──── This is an örängë + ───╯ + "); } #[test] @@ -1068,7 +1064,7 @@ mod tests { let source = "äpplë == örängë;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii().with_index_type(IndexType::Byte)) + .with_config(no_color().with_index_type(IndexType::Byte)) .with_message("can't compare äpplës with örängës") .with_label(Label::new(0..7).with_message("This is an äpplë")) .with_label(Label::new(11..20).with_message("This is an örängë")) @@ -1076,17 +1072,17 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if these lines didn't cross - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare äpplës with örängës - ,-[ :1:1 ] - | - 1 | äpplë == örängë; - | ^^|^^ ^^^|^^ - | `-------------- This is an äpplë - | | - | `---- This is an örängë - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ äpplë == örängë; + │ ──┬── ───┬── + │ ╰────────────── This is an äpplë + │ │ + │ ╰──── This is an örängë + ───╯ + "); } #[test] @@ -1094,7 +1090,7 @@ mod tests { let source = "äpplë == örängë;"; let msg = remove_trailing( Report::build(ReportKind::Error, 11..11) - .with_config(no_color_and_ascii().with_index_type(IndexType::Byte)) + .with_config(no_color().with_index_type(IndexType::Byte)) .with_message("can't compare äpplës with örängës") .with_label(Label::new(0..7).with_message("This is an äpplë")) .with_label(Label::new(11..20).with_message("This is an örängë")) @@ -1102,17 +1098,17 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if these lines didn't cross - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare äpplës with örängës - ,-[ :1:10 ] - | - 1 | äpplë == örängë; - | ^^|^^ ^^^|^^ - | `-------------- This is an äpplë - | | - | `---- This is an örängë - ---' - "###); + ╭─[ :1:10 ] + │ + 1 │ äpplë == örängë; + │ ──┬── ───┬── + │ ╰────────────── This is an äpplë + │ │ + │ ╰──── This is an örängë + ───╯ + "); } #[test] @@ -1120,7 +1116,7 @@ mod tests { let source = format!("{}orange", "apple == ".repeat(100)); let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label( Label::new(source.len() - 5..source.len()).with_message("This is an orange"), @@ -1129,15 +1125,15 @@ mod tests { .write_to_string(Source::from(source)), ); // TODO: it would be nice if the start of long lines would be omitted (like rustc does) - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange - | ^^|^^ - | `---- This is an orange - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == apple == orange + │ ──┬── + │ ╰──── This is an orange + ───╯ + "); } #[test] @@ -1145,22 +1141,22 @@ mod tests { let source = "apple ==\n"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii().with_index_type(IndexType::Byte)) + .with_config(no_color().with_index_type(IndexType::Byte)) .with_message("unexpected end of file") .with_label(Label::new(9..9).with_message("Unexpected end of file")) .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: unexpected end of file - ,-[ :1:1 ] - | - 1 | apple == - | | - | `- Unexpected end of file - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ apple == + │ │ + │ ╰─ Unexpected end of file + ───╯ + "); } #[test] @@ -1168,22 +1164,22 @@ mod tests { let source = ""; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("unexpected end of file") .with_label(Label::new(0..0).with_message("No more fruit!")) .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: unexpected end of file - ,-[ :1:1 ] - | - 1 | - | | - | `- No more fruit! - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ + │ │ + │ ╰─ No more fruit! + ───╯ + "); } #[test] @@ -1191,7 +1187,7 @@ mod tests { let source = ""; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("unexpected end of file") .with_label(Label::new(0..0).with_message("No more fruit!")) .with_help("have you tried going to the farmer's market?") @@ -1199,17 +1195,17 @@ mod tests { .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: unexpected end of file - ,-[ :1:1 ] - | - 1 | - | | - | `- No more fruit! - | - | Help: have you tried going to the farmer's market? - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ + │ │ + │ ╰─ No more fruit! + │ + │ Help: have you tried going to the farmer's market? + ───╯ + "); } #[test] @@ -1217,7 +1213,7 @@ mod tests { let source = ""; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("unexpected end of file") .with_label(Label::new(0..0).with_message("No more fruit!")) .with_note("eat your greens!") @@ -1225,17 +1221,17 @@ mod tests { .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: unexpected end of file - ,-[ :1:1 ] - | - 1 | - | | - | `- No more fruit! - | - | Note: eat your greens! - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ + │ │ + │ ╰─ No more fruit! + │ + │ Note: eat your greens! + ───╯ + "); } #[test] @@ -1243,7 +1239,7 @@ mod tests { let source = ""; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("unexpected end of file") .with_label(Label::new(0..0).with_message("No more fruit!")) .with_note("eat your greens!") @@ -1252,19 +1248,19 @@ mod tests { .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: unexpected end of file - ,-[ :1:1 ] - | - 1 | - | | - | `- No more fruit! - | - | Help: have you tried going to the farmer's market? - | - | Note: eat your greens! - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ + │ │ + │ ╰─ No more fruit! + │ + │ Help: have you tried going to the farmer's market? + │ + │ Note: eat your greens! + ───╯ + "); } #[test] @@ -1275,7 +1271,7 @@ mod tests { for j in i..=source.len() { let _ = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii().with_index_type(IndexType::Byte)) + .with_config(no_color().with_index_type(IndexType::Byte)) .with_message("Label") .with_label(Label::new(i..j).with_message("Label")) .finish() @@ -1290,23 +1286,23 @@ mod tests { let source = "apple\n==\norange"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_label(Label::new(0..source.len()).with_message("illegal comparison")) .finish() .write_to_string(Source::from(source)), ); // TODO: it would be nice if the 2nd line wasn't omitted - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: - ,-[ :1:1 ] - | - 1 | ,-> apple - : : - 3 | |-> orange - | | - | `----------- illegal comparison - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ ╭─▶ apple + ┆ ┆ + 3 │ ├─▶ orange + │ │ + │ ╰─────────── illegal comparison + ───╯ + "); } #[test] @@ -1314,24 +1310,24 @@ mod tests { let source = "https://example.com/"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_label(Label::new(0..source.len()).with_message("URL")) .with_label(Label::new(0..source.find(':').unwrap()).with_message("scheme")) .finish() .write_to_string(Source::from(source)), ); // TODO: it would be nice if you could tell where the spans start and end. - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: - ,-[ :1:1 ] - | - 1 | https://example.com/ - | ^^|^^^^^^^|^^^^^^^^^ - | `------------------- scheme - | | - | `----------- URL - ---' - "###); + ╭─[ :1:1 ] + │ + 1 │ https://example.com/ + │ ──┬───────┬───────── + │ ╰─────────────────── scheme + │ │ + │ ╰─────────── URL + ───╯ + "); } #[test] @@ -1339,7 +1335,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label( @@ -1354,25 +1350,25 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ ^^^|^^ - | `-------------- This is an apple - | | | - | `-------------- Have I mentioned that this is an apple? - | | | - | `-------------- No really, have I mentioned that? - | | - | `---- This is an orange - | | - | `---- Have I mentioned that this is an orange? - | | - | `---- No really, have I mentioned that? - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ │ + │ ╰────────────── Have I mentioned that this is an apple? + │ │ │ + │ ╰────────────── No really, have I mentioned that? + │ │ + │ ╰──── This is an orange + │ │ + │ ╰──── Have I mentioned that this is an orange? + │ │ + │ ╰──── No really, have I mentioned that? + ───╯ + ") } #[test] @@ -1380,7 +1376,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label(Label::new(9..15).with_message("This is an orange")) @@ -1388,19 +1384,19 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ ^^^|^^ - | `-------------- This is an apple - | | - | `---- This is an orange - | - | Note: stop trying ... this is a fruitless endeavor - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + │ + │ Note: stop trying ... this is a fruitless endeavor + ───╯ + ") } #[test] @@ -1408,7 +1404,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label(Label::new(9..15).with_message("This is an orange")) @@ -1416,19 +1412,19 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ ^^^|^^ - | `-------------- This is an apple - | | - | `---- This is an orange - | - | Help: have you tried peeling the orange? - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + │ + │ Help: have you tried peeling the orange? + ───╯ + ") } #[test] @@ -1436,7 +1432,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..5).with_message("This is an apple")) .with_label(Label::new(9..15).with_message("This is an orange")) @@ -1445,21 +1441,21 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^|^^ ^^^|^^ - | `-------------- This is an apple - | | - | `---- This is an orange - | - | Help: have you tried peeling the orange? - | - | Note: stop trying ... this is a fruitless endeavor - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + │ + │ Help: have you tried peeling the orange? + │ + │ Note: stop trying ... this is a fruitless endeavor + ───╯ + ") } #[test] @@ -1467,24 +1463,24 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..15).with_message("This is a strange comparison")) .with_note("No need to try, they can't be compared.") .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^^^^^^|^^^^^^^ - | `--------- This is a strange comparison - | - | Note: No need to try, they can't be compared. - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ───────┬─────── + │ ╰───────── This is a strange comparison + │ + │ Note: No need to try, they can't be compared. + ───╯ + ") } #[test] @@ -1492,7 +1488,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..15).with_message("This is a strange comparison")) .with_note("No need to try, they can't be compared.") @@ -1500,19 +1496,19 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^^^^^^|^^^^^^^ - | `--------- This is a strange comparison - | - | Note 1: No need to try, they can't be compared. - | - | Note 2: Yeah, really, please stop. - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ───────┬─────── + │ ╰───────── This is a strange comparison + │ + │ Note 1: No need to try, they can't be compared. + │ + │ Note 2: Yeah, really, please stop. + ───╯ + ") } #[test] @@ -1520,7 +1516,7 @@ mod tests { let source = "apple == orange;"; let msg = remove_trailing( Report::build(ReportKind::Error, 0..0) - .with_config(no_color_and_ascii()) + .with_config(no_color()) .with_message("can't compare apples with oranges") .with_label(Label::new(0..15).with_message("This is a strange comparison")) .with_note("No need to try, they can't be compared.") @@ -1528,19 +1524,19 @@ mod tests { .finish() .write_to_string(Source::from(source)), ); - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare apples with oranges - ,-[ :1:1 ] - | - 1 | apple == orange; - | ^^^^^^^|^^^^^^^ - | `--------- This is a strange comparison - | - | Note 1: No need to try, they can't be compared. - | - | Note 2: Yeah, really, please stop. - | It has no resemblance. - ---' - "###) + ╭─[ :1:1 ] + │ + 1 │ apple == orange; + │ ───────┬─────── + │ ╰───────── This is a strange comparison + │ + │ Note 1: No need to try, they can't be compared. + │ + │ Note 2: Yeah, really, please stop. + │ It has no resemblance. + ───╯ + ") } } From bf18d02d0434b24e938291724f1c6ce914640674 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 29 May 2024 23:25:02 +0200 Subject: [PATCH 26/38] Add a few more tests --- src/write.rs | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/write.rs b/src/write.rs index f4f091e..1d653f4 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1111,6 +1111,30 @@ mod tests { "); } + #[test] + fn crossing_lines() { + let source = "äpplë == örängë;"; + let msg = Report::>::build(ReportKind::Error, (), 11) + .with_config(no_color().with_cross_gap(false)) + .with_message("can't compare äpplës with örängës") + .with_label(Label::new(0..5).with_message("This is an äpplë")) + .with_label(Label::new(9..15).with_message("This is an örängë")) + .finish() + .write_to_string(Source::from(source)); + // TODO: it would be nice if these lines didn't cross + assert_snapshot!(msg, @r###" + Error: can't compare äpplës with örängës + ╭─[:1:12] + │ + 1 │ äpplë == örängë; + │ ──┬── ───┬── + │ ╰─────────┼──── This is an äpplë + │ │ + │ ╰──── This is an örängë + ───╯ + "###); + } + #[test] fn label_at_end_of_long_line() { let source = format!("{}orange", "apple == ".repeat(100)); @@ -1305,6 +1329,39 @@ mod tests { "); } + #[test] + fn multiple_multilines_same_span() { + let source = "apple\n==\norange"; + let msg = Report::>::build(ReportKind::Error, (), 0) + .with_config(no_color()) + .with_label(Label::new(0..source.len()).with_message("illegal comparison")) + .with_label(Label::new(0..source.len()).with_message("do not do this")) + .with_label(Label::new(0..source.len()).with_message("please reconsider")) + .finish() + .write_to_string(Source::from(source)); + // TODO: it would be nice if the 2nd line wasn't omitted + // TODO: it would be nice if the lines didn't cross, or at least less so + assert_snapshot!(msg, @r###" + Error: + ╭─[:1:1] + │ + 1 │ ╭─────▶ apple + │ │ ▲ + │ │ ╭─────╯ + │ │ │ │ + │ │ │ ╭───╯ + ┆ ┆ ┆ ┆ + 3 │ ├─│ │ ▶ orange + │ │ │ │ ▲ + │ ╰─────────────── illegal comparison + │ │ │ │ + │ ╰──────────┴── do not do this + │ │ │ + │ ╰────────┴── please reconsider + ───╯ + "###); + } + #[test] fn partially_overlapping_labels() { let source = "https://example.com/"; From 1f8e9a3be6ee18fbc0e00151d5e8860eda056070 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 00:33:34 +0200 Subject: [PATCH 27/38] Build the `line_labels` array in a single statement --- src/write.rs | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/write.rs b/src/write.rs index 1d653f4..89c0f66 100644 --- a/src/write.rs +++ b/src/write.rs @@ -424,6 +424,8 @@ impl Report<'_, S> { continue; }; + // The (optional) label whose arrows are drawn in the margin (horizontal), + // instead of normally (vertical). let margin_label = multi_labels_with_message .iter() .enumerate() @@ -480,28 +482,31 @@ impl Report<'_, S> { None } }) - .collect::>(); - - for label_info in group.labels.iter().filter(|l| { - l.char_span.start >= line.span().start && l.char_span.end <= line.span().end - }) { - if matches!(label_info.kind, LabelKind::Inline) { - line_labels.push(LineLabel { - col: match &self.config.label_attach { - LabelAttach::Start => label_info.char_span.start, - LabelAttach::Middle => { - (label_info.char_span.start + label_info.char_span.end) / 2 + .chain( + group + .labels + .iter() + .filter(|label_info| { + matches!(label_info.kind, LabelKind::Inline) + && label_info.char_span.start >= line.span().start + && label_info.char_span.end <= line.span().end + }) + .map(|label_info| LineLabel { + col: match &self.config.label_attach { + LabelAttach::Start => label_info.char_span.start, + LabelAttach::Middle => { + (label_info.char_span.start + label_info.char_span.end) / 2 + } + LabelAttach::End => label_info.last_offset(), } - LabelAttach::End => label_info.last_offset(), - } - .max(label_info.char_span.start) - - line.offset(), - label: label_info, - multi: false, - draw_msg: true, - }); - } - } + .max(label_info.char_span.start) + - line.offset(), + label: label_info, + multi: false, + draw_msg: true, + }), + ) + .collect::>(); // Skip this line if we don't have labels for it if line_labels.is_empty() && margin_label.is_none() { From 531a5e06cacbc1e6e91f4ee90cb700b3baf1a9e2 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 00:37:44 +0200 Subject: [PATCH 28/38] Factor out a function for checking if a label is the margin one --- src/write.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/write.rs b/src/write.rs index 89c0f66..8ce2225 100644 --- a/src/write.rs +++ b/src/write.rs @@ -452,6 +452,11 @@ impl Report<'_, S> { } }) .min_by_key(|ll| (ll.col, !ll.label.char_span.start)); + let is_margin_label = |label| { + margin_label + .as_ref() + .map_or(false, |m_label| m_label.is_referencing(label)) + }; // Generate a list of labels for this line, along with their label columns let mut line_labels = multi_labels_with_message @@ -459,11 +464,7 @@ impl Report<'_, S> { .filter_map(|label| { let is_start = line.span().contains(&label.char_span.start); let is_end = line.span().contains(&label.last_offset()); - if is_start - && margin_label - .as_ref() - .map_or(true, |m| !m.is_referencing(label)) - { + if is_start && !is_margin_label(label) { // TODO: Check to see whether multi is the first on the start line or first on the end line Some(LineLabel { col: label.char_span.start - line.offset(), @@ -553,10 +554,7 @@ impl Report<'_, S> { // Only labels with notes get an arrow .enumerate() .filter(|(_, ll)| { - ll.label.display_info.msg.is_some() - && margin_label - .as_ref() - .map_or(true, |m| !m.is_referencing(ll.label)) + ll.label.display_info.msg.is_some() && !is_margin_label(ll.label) }) .find(|(j, ll)| ll.col == col && row <= *j) .map(|(_, ll)| ll) @@ -723,9 +721,7 @@ impl Report<'_, S> { && line_label.label.display_info.msg.is_some(); let [c, tail] = if col == line_label.col && line_label.label.display_info.msg.is_some() - && margin_label - .as_ref() - .map_or(true, |m| !m.is_referencing(line_label.label)) + && !is_margin_label(line_label.label) { [ if line_label.multi { From 138006fc70be2042cc815d2e7e01affd24974bd6 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 01:22:00 +0200 Subject: [PATCH 29/38] Avoid trying to render labels when printing help or notes There aren't any labels left by that point --- src/write.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/write.rs b/src/write.rs index 8ce2225..9cc0391 100644 --- a/src/write.rs +++ b/src/write.rs @@ -780,20 +780,20 @@ impl Report<'_, S> { let is_final_group = group_idx + 1 == groups_len; // Help - if let (Some(note), true) = (&self.help, is_final_group) { + if let (Some(help), true) = (&self.help, is_final_group) { if !self.config.compact { - write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; writeln!(w)?; } - write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; - writeln!(w, "{}: {note}", "Help".fg(self.config.note_color(), s))?; + write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; + writeln!(w, "{}: {help}", "Help".fg(self.config.note_color(), s))?; } // Note if is_final_group { for (i, note) in self.notes.iter().enumerate() { if !self.config.compact { - write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; writeln!(w)?; } let note_prefix = format!("{} {}", "Note", i + 1); @@ -804,7 +804,7 @@ impl Report<'_, S> { }; let mut lines = note.lines(); if let Some(line) = lines.next() { - write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; if self.notes.len() > 1 { writeln!(w, "{}: {line}", note_prefix.fg(self.config.note_color(), s),)?; } else { @@ -1115,7 +1115,7 @@ mod tests { #[test] fn crossing_lines() { let source = "äpplë == örängë;"; - let msg = Report::>::build(ReportKind::Error, (), 11) + let msg = Report::build(ReportKind::Error, 11..11) .with_config(no_color().with_cross_gap(false)) .with_message("can't compare äpplës with örängës") .with_label(Label::new(0..5).with_message("This is an äpplë")) @@ -1123,9 +1123,9 @@ mod tests { .finish() .write_to_string(Source::from(source)); // TODO: it would be nice if these lines didn't cross - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: can't compare äpplës with örängës - ╭─[:1:12] + ╭─[ :1:12 ] │ 1 │ äpplë == örängë; │ ──┬── ───┬── @@ -1133,7 +1133,7 @@ mod tests { │ │ │ ╰──── This is an örängë ───╯ - "###); + "); } #[test] @@ -1333,7 +1333,7 @@ mod tests { #[test] fn multiple_multilines_same_span() { let source = "apple\n==\norange"; - let msg = Report::>::build(ReportKind::Error, (), 0) + let msg = Report::build(ReportKind::Error, 0..0) .with_config(no_color()) .with_label(Label::new(0..source.len()).with_message("illegal comparison")) .with_label(Label::new(0..source.len()).with_message("do not do this")) @@ -1342,9 +1342,9 @@ mod tests { .write_to_string(Source::from(source)); // TODO: it would be nice if the 2nd line wasn't omitted // TODO: it would be nice if the lines didn't cross, or at least less so - assert_snapshot!(msg, @r###" + assert_snapshot!(msg, @r" Error: - ╭─[:1:1] + ╭─[ :1:1 ] │ 1 │ ╭─────▶ apple │ │ ▲ @@ -1360,7 +1360,7 @@ mod tests { │ │ │ │ ╰────────┴── please reconsider ───╯ - "###); + "); } #[test] From 53c0c8a6905c74b2d382cbe6b5196e9cea538713 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 13:29:11 +0200 Subject: [PATCH 30/38] Split off `write_margin` into two functions This eliminates a few parameters, and makes each "section"'s purpose more evident --- src/write.rs | 296 +++++++++++++++++++++++++-------------------------- 1 file changed, 147 insertions(+), 149 deletions(-) diff --git a/src/write.rs b/src/write.rs index 9cc0391..e4bd862 100644 --- a/src/write.rs +++ b/src/write.rs @@ -187,6 +187,26 @@ impl Report<'_, S> { let margin_char = |c: char| c.fg(self.config.margin_color(), s); + let write_margin = |w: &mut W, idx: usize, is_src_line: bool, is_ellipsis: bool| { + let line_num_margin = if is_src_line && !is_ellipsis { + format!("{:line_num_width$} {}", idx + 1, draw.vbar) + .fg(self.config.margin_color(), s) + } else { + format!( + "{}{}", + Rept(' ', line_num_width + 1), + draw.vbar(is_ellipsis) + ) + .fg(self.config.skipped_margin_color(), s) + }; + + write!( + w, + " {line_num_margin}{}", + Show((!self.config.compact).then_some(' ')), + ) + }; + // --- Source sections --- let groups_len = groups.len(); for (group_idx, group) in groups.into_iter().enumerate() { @@ -256,162 +276,143 @@ impl Report<'_, S> { .filter(|label_info| label_info.display_info.msg.is_some()) .collect(); - let write_margin = |w: &mut W, - idx: usize, - is_src_line: bool, - is_ellipsis: bool, - draw_labels: bool, - report_row: Option<(usize, bool)>, - line_labels: &[LineLabel], - margin_label: &Option| + let write_margin_and_arrows = |w: &mut W, + idx: usize, + is_src_line: bool, + is_ellipsis: bool, + report_row: Option<(usize, bool)>, + line_labels: &[LineLabel], + margin_label: &Option| -> std::io::Result<()> { - let line_num_margin = if is_src_line && !is_ellipsis { - format!("{:line_num_width$} {}", idx + 1, draw.vbar) - .fg(self.config.margin_color(), s) - } else { - format!( - "{}{}", - Rept(' ', line_num_width + 1), - draw.vbar(is_ellipsis) - ) - .fg(self.config.skipped_margin_color(), s) - }; - - write!( - w, - " {line_num_margin}{}", - Show((!self.config.compact).then_some(' ')), - )?; + write_margin(w, idx, is_src_line, is_ellipsis)?; // Multi-line margins - if draw_labels { - for col in 0..multi_labels_with_message.len() - + (!multi_labels_with_message.is_empty()) as usize + for col in 0..multi_labels_with_message.len() + + (!multi_labels_with_message.is_empty()) as usize + { + let mut corner = None; + let mut hbar: Option<&LabelInfo> = None; + let mut vbar: Option<&LabelInfo> = None; + let mut margin_ptr = None; + + let multi_label = multi_labels_with_message.get(col); + let line_span = src.line(idx).unwrap().span(); + + for (i, label) in multi_labels_with_message + [0..(col + 1).min(multi_labels_with_message.len())] + .iter() + .enumerate() { - let mut corner = None; - let mut hbar: Option<&LabelInfo> = None; - let mut vbar: Option<&LabelInfo> = None; - let mut margin_ptr = None; - - let multi_label = multi_labels_with_message.get(col); - let line_span = src.line(idx).unwrap().span(); + let margin = margin_label.as_ref().filter(|m| m.is_referencing(label)); - for (i, label) in multi_labels_with_message - [0..(col + 1).min(multi_labels_with_message.len())] - .iter() - .enumerate() + if label.char_span.start <= line_span.end + && label.char_span.end > line_span.start { - let margin = margin_label.as_ref().filter(|m| m.is_referencing(label)); - - if label.char_span.start <= line_span.end - && label.char_span.end > line_span.start - { - let is_parent = i != col; - let is_start = line_span.contains(&label.char_span.start); - let is_end = line_span.contains(&label.last_offset()); - - if let (Some(margin), true) = (margin, is_src_line) { - margin_ptr = Some((margin, is_start)); - } else if !is_start && (!is_end || is_src_line) { - vbar = vbar.or((!is_parent).then_some(*label)); - } else if let Some((report_row, is_arrow)) = report_row { - let label_row = line_labels - .iter() - .enumerate() - .find(|(_, l)| l.is_referencing(label)) - .map_or(0, |(r, _)| r); - if report_row == label_row { - if let Some(margin) = margin { - vbar = (col == i).then_some(margin.label); - if is_start { - continue; - } + let is_parent = i != col; + let is_start = line_span.contains(&label.char_span.start); + let is_end = line_span.contains(&label.last_offset()); + + if let (Some(margin), true) = (margin, is_src_line) { + margin_ptr = Some((margin, is_start)); + } else if !is_start && (!is_end || is_src_line) { + vbar = vbar.or((!is_parent).then_some(*label)); + } else if let Some((report_row, is_arrow)) = report_row { + let label_row = line_labels + .iter() + .enumerate() + .find(|(_, l)| l.is_referencing(label)) + .map_or(0, |(r, _)| r); + if report_row == label_row { + if let Some(margin) = margin { + vbar = (col == i).then_some(margin.label); + if is_start { + continue; } + } - if is_arrow { - hbar = Some(*label); - if !is_parent { - corner = Some((label, is_start)); - } - } else if !is_start { - vbar = vbar.or((!is_parent).then_some(*label)); + if is_arrow { + hbar = Some(*label); + if !is_parent { + corner = Some((label, is_start)); } - } else { - vbar = vbar.or((!is_parent - && (is_start ^ (report_row < label_row))) - .then_some(*label)); + } else if !is_start { + vbar = vbar.or((!is_parent).then_some(*label)); } + } else { + vbar = vbar + .or((!is_parent && (is_start ^ (report_row < label_row))) + .then_some(*label)); } } } + } - if let (Some((margin, _is_start)), true) = (margin_ptr, is_src_line) { - let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); - let is_limit = col + 1 == multi_labels_with_message.len(); - if !is_col && !is_limit { - hbar = hbar.or(Some(margin.label)); - } + if let (Some((margin, _is_start)), true) = (margin_ptr, is_src_line) { + let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); + let is_limit = col + 1 == multi_labels_with_message.len(); + if !is_col && !is_limit { + hbar = hbar.or(Some(margin.label)); } + } - hbar = hbar.filter(|l| { - !margin_label - .as_ref() - .map_or(false, |margin| margin.is_referencing(l)) - || !is_src_line - }); + hbar = hbar.filter(|l| { + !margin_label + .as_ref() + .map_or(false, |margin| margin.is_referencing(l)) + || !is_src_line + }); - let (a, b) = if let Some((label, is_start)) = corner { - ( - Some((draw.arrow_bend(is_start), *label)), - Some((draw.hbar, *label)), - ) - } else if let Some(label) = hbar { - ( - Some(( - if vbar.is_some() && !self.config.cross_gap { - // Crossing with a vertical arrow, and the config allows us to cross them. - draw.xbar - } else { - draw.hbar - }, - label, - )), - Some((draw.hbar, label)), - ) - } else if let Some(label) = vbar { - (Some((draw.vbar(is_ellipsis), label)), None) - } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { - let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); - let is_limit = col == multi_labels_with_message.len(); - ( - Some(( - if is_limit { - draw.rarrow - } else if is_col { - if is_start { - draw.ltop - } else { - draw.lcross - } + let (a, b) = if let Some((label, is_start)) = corner { + ( + Some((draw.arrow_bend(is_start), *label)), + Some((draw.hbar, *label)), + ) + } else if let Some(label) = hbar { + ( + Some(( + if vbar.is_some() && !self.config.cross_gap { + // Crossing with a vertical arrow, and the config allows us to cross them. + draw.xbar + } else { + draw.hbar + }, + label, + )), + Some((draw.hbar, label)), + ) + } else if let Some(label) = vbar { + (Some((draw.vbar(is_ellipsis), label)), None) + } else if let (Some((margin, is_start)), true) = (margin_ptr, is_src_line) { + let is_col = multi_label.map_or(false, |ml| margin.is_referencing(ml)); + let is_limit = col == multi_labels_with_message.len(); + ( + Some(( + if is_limit { + draw.rarrow + } else if is_col { + if is_start { + draw.ltop } else { - draw.hbar - }, - margin.label, - )), - Some((if is_limit { ' ' } else { draw.hbar }, margin.label)), - ) - } else { - (None, None) - }; + draw.lcross + } + } else { + draw.hbar + }, + margin.label, + )), + Some((if is_limit { ' ' } else { draw.hbar }, margin.label)), + ) + } else { + (None, None) + }; - let arrow_char = |opt: Option<(char, &LabelInfo<'_>)>| match opt { - Some((c, label)) => c.fg(label.display_info.color, s), - None => ' '.fg(None, s), - }; - write!(w, "{}", arrow_char(a))?; - if !self.config.compact { - write!(w, "{}", arrow_char(b))?; - } + let arrow_char = |opt: Option<(char, &LabelInfo<'_>)>| match opt { + Some((c, label)) => c.fg(label.display_info.color, s), + None => ' '.fg(None, s), + }; + write!(w, "{}", arrow_char(a))?; + if !self.config.compact { + write!(w, "{}", arrow_char(b))?; } } @@ -518,7 +519,7 @@ impl Report<'_, S> { is_ellipsis = true; } else { if !self.config.compact && !is_ellipsis { - write_margin(&mut w, idx, false, is_ellipsis, false, None, &[], &None)?; + write_margin(&mut w, idx, false, is_ellipsis)?; writeln!(w)?; } is_ellipsis = true; @@ -595,12 +596,11 @@ impl Report<'_, S> { }; // Margin - write_margin( + write_margin_and_arrows( &mut w, idx, true, is_ellipsis, - true, None, &line_labels, &margin_label, @@ -641,12 +641,11 @@ impl Report<'_, S> { } if !self.config.compact { // Margin alternate - write_margin( + write_margin_and_arrows( &mut w, idx, false, is_ellipsis, - true, Some((row, false)), &line_labels, &margin_label, @@ -699,12 +698,11 @@ impl Report<'_, S> { } // Margin - write_margin( + write_margin_and_arrows( &mut w, idx, false, is_ellipsis, - true, Some((row, true)), &line_labels, &margin_label, @@ -782,10 +780,10 @@ impl Report<'_, S> { // Help if let (Some(help), true) = (&self.help, is_final_group) { if !self.config.compact { - write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false)?; writeln!(w)?; } - write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false)?; writeln!(w, "{}: {help}", "Help".fg(self.config.note_color(), s))?; } @@ -793,7 +791,7 @@ impl Report<'_, S> { if is_final_group { for (i, note) in self.notes.iter().enumerate() { if !self.config.compact { - write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false)?; writeln!(w)?; } let note_prefix = format!("{} {}", "Note", i + 1); @@ -804,7 +802,7 @@ impl Report<'_, S> { }; let mut lines = note.lines(); if let Some(line) = lines.next() { - write_margin(&mut w, 0, false, false, false, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false)?; if self.notes.len() > 1 { writeln!(w, "{}: {line}", note_prefix.fg(self.config.note_color(), s),)?; } else { @@ -812,7 +810,7 @@ impl Report<'_, S> { } } for line in lines { - write_margin(&mut w, 0, false, false, true, Some((0, false)), &[], &None)?; + write_margin(&mut w, 0, false, false)?; writeln!(w, "{:>pad$}{line}", "", pad = note_prefix_len + 2)?; } } From a14e462790029f0ebd6050819123a6e492489338 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 13:30:43 +0200 Subject: [PATCH 31/38] Remove an unused `enumerate()` --- src/write.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/write.rs b/src/write.rs index e4bd862..3da097d 100644 --- a/src/write.rs +++ b/src/write.rs @@ -429,8 +429,7 @@ impl Report<'_, S> { // instead of normally (vertical). let margin_label = multi_labels_with_message .iter() - .enumerate() - .filter_map(|(_i, label)| { + .filter_map(|label| { let is_start = line.span().contains(&label.char_span.start); let is_end = line.span().contains(&label.last_offset()); if is_start { From 059429fa3b69775cf3d7323f6e4b882f350d040d Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 14:51:59 +0200 Subject: [PATCH 32/38] Add multi-source tests --- src/write.rs | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/src/write.rs b/src/write.rs index 3da097d..065da10 100644 --- a/src/write.rs +++ b/src/write.rs @@ -926,7 +926,7 @@ mod tests { use insta::assert_snapshot; - use crate::{Cache, CharSet, Config, IndexType, Label, Report, ReportKind, Source, Span}; + use crate::{Cache, Config, FnCache, IndexType, Label, Report, ReportKind, Source, Span}; impl Report<'_, S> { fn write_to_string>(&self, cache: C) -> String { @@ -944,6 +944,12 @@ mod tests { s.lines().flat_map(|l| [l.trim_end(), "\n"]).collect() } + fn multi_sources<'srcs, const NB_SOURCES: usize>( + sources: &'srcs [&'static str; NB_SOURCES], + ) -> impl Cache + 'srcs { + FnCache::new(move |id: &_| Ok(sources[*id])) + } + #[test] fn one_message() { let msg = remove_trailing( @@ -1594,4 +1600,78 @@ mod tests { ───╯ ") } + + #[test] + fn multi_source() { + let msg = remove_trailing( + Report::build(ReportKind::Error, (0, 0..0)) + .with_config(no_color()) + .with_message("can't compare apples with oranges or pears") + .with_label(Label::new((0, 0..5)).with_message("This is an apple")) + .with_label(Label::new((0, 9..15)).with_message("This is an orange")) + .with_label(Label::new((1, 0..5)).with_message("This is an apple")) + .with_label(Label::new((1, 9..13)).with_message("This is a pear")) + .finish() + .write_to_string(multi_sources(&["apple == orange;", "apple == pear;"])), + ); + assert_snapshot!(msg, @r" + Error: can't compare apples with oranges or pears + ╭─[ 0:1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + │ + ├─[ 1:1:1 ] + │ + 1 │ apple == pear; + │ ──┬── ──┬─ + │ ╰──────────── This is an apple + │ │ + │ ╰─── This is a pear + ───╯ + ") + } + + #[test] + fn help_and_note_multi() { + let msg = remove_trailing( + Report::build(ReportKind::Error, (0, 0..0)) + .with_config(no_color()) + .with_message("can't compare apples with oranges or pears") + .with_label(Label::new((0, 0..5)).with_message("This is an apple")) + .with_label(Label::new((0, 9..15)).with_message("This is an orange")) + .with_label(Label::new((1, 0..5)).with_message("This is an apple")) + .with_label(Label::new((1, 9..13)).with_message("This is a pear")) + .with_help("have you tried peeling the orange?") + .with_note("stop trying ... this is a fruitless endeavor") + .finish() + .write_to_string(multi_sources(&["apple == orange;", "apple == pear;"])), + ); + assert_snapshot!(msg, @r" + Error: can't compare apples with oranges or pears + ╭─[ 0:1:1 ] + │ + 1 │ apple == orange; + │ ──┬── ───┬── + │ ╰────────────── This is an apple + │ │ + │ ╰──── This is an orange + │ + ├─[ 1:1:1 ] + │ + 1 │ apple == pear; + │ ──┬── ──┬─ + │ ╰──────────── This is an apple + │ │ + │ ╰─── This is a pear + │ + │ Help: have you tried peeling the orange? + │ + │ Note: stop trying ... this is a fruitless endeavor + ───╯ + ") + } } From 493d7b5f92e6ad095a9fdfd9b028b68524fdefc3 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 15:25:35 +0200 Subject: [PATCH 33/38] Factor out a function to write spacer lines --- src/write.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/write.rs b/src/write.rs index 065da10..fcc5f8a 100644 --- a/src/write.rs +++ b/src/write.rs @@ -206,6 +206,18 @@ impl Report<'_, S> { Show((!self.config.compact).then_some(' ')), ) }; + let write_spacer_line = |w: &mut W| { + if !self.config.compact { + writeln!( + w, + "{}{}", + Rept(' ', line_num_width + 2), + margin_char(draw.vbar) + ) + } else { + Ok(()) + } + }; // --- Source sections --- let groups_len = groups.len(); @@ -254,12 +266,7 @@ impl Report<'_, S> { )?; if !self.config.compact { - writeln!( - w, - "{}{}", - Rept(' ', line_num_width + 2), - margin_char(draw.vbar) - )?; + write_spacer_line(&mut w)?; } // Generate a list of multi-line labels @@ -825,12 +832,7 @@ impl Report<'_, S> { .fg(self.config.margin_color(), s) )?; } else { - writeln!( - w, - "{}{}", - Rept(' ', line_num_width + 2), - margin_char(draw.vbar) - )?; + write_spacer_line(&mut w)?; } } } From fa4b46a1d81c24d1e1dfaee780004973c691df13 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 15:35:15 +0200 Subject: [PATCH 34/38] Print spacers before groups, rather than after This leads to slightly simpler logic --- src/draw.rs | 8 ----- src/write.rs | 98 +++++++++++++++++++++++++++------------------------- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/draw.rs b/src/draw.rs index 21ab83a..fd1abcd 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -92,14 +92,6 @@ impl Characters { self.vbar } } - - pub(crate) fn group_connector(&self, is_first_group: bool) -> char { - if is_first_group { - self.ltop - } else { - self.lcross - } - } } /// Output stream to check for whether color is enabled. diff --git a/src/write.rs b/src/write.rs index fcc5f8a..5af9852 100644 --- a/src/write.rs +++ b/src/write.rs @@ -255,11 +255,17 @@ impl Report<'_, S> { }), }, ); + let corner_char = if group_idx == 0 { + draw.ltop + } else { + write_spacer_line(&mut w)?; + draw.lcross + }; writeln!( w, "{}{}{}{} {location} {}", Rept(' ', line_num_width + 2), - margin_char(draw.group_connector(group_idx == 0)), + margin_char(corner_char), margin_char(draw.hbar), margin_char(draw.lbox), margin_char(draw.rbox), @@ -780,62 +786,58 @@ impl Report<'_, S> { writeln!(w)?; } } + } - let is_final_group = group_idx + 1 == groups_len; - - // Help - if let (Some(help), true) = (&self.help, is_final_group) { - if !self.config.compact { - write_margin(&mut w, 0, false, false)?; - writeln!(w)?; - } + // Help + if let Some(help) = &self.help { + if !self.config.compact { write_margin(&mut w, 0, false, false)?; - writeln!(w, "{}: {help}", "Help".fg(self.config.note_color(), s))?; - } - - // Note - if is_final_group { - for (i, note) in self.notes.iter().enumerate() { - if !self.config.compact { - write_margin(&mut w, 0, false, false)?; - writeln!(w)?; - } - let note_prefix = format!("{} {}", "Note", i + 1); - let note_prefix_len = if self.notes.len() > 1 { - note_prefix.len() - } else { - 4 - }; - let mut lines = note.lines(); - if let Some(line) = lines.next() { - write_margin(&mut w, 0, false, false)?; - if self.notes.len() > 1 { - writeln!(w, "{}: {line}", note_prefix.fg(self.config.note_color(), s),)?; - } else { - writeln!(w, "{}: {line}", "Note".fg(self.config.note_color(), s))?; - } - } - for line in lines { - write_margin(&mut w, 0, false, false)?; - writeln!(w, "{:>pad$}{line}", "", pad = note_prefix_len + 2)?; - } - } + writeln!(w)?; } + write_margin(&mut w, 0, false, false)?; + writeln!(w, "{}: {help}", "Help".fg(self.config.note_color(), s))?; + } - // Tail of report + // Notes + for (i, note) in self.notes.iter().enumerate() { if !self.config.compact { - if is_final_group { - writeln!( - w, - "{}", - format_args!("{}{}", Rept(draw.hbar, line_num_width + 2), draw.rbot) - .fg(self.config.margin_color(), s) - )?; + write_margin(&mut w, 0, false, false)?; + writeln!(w)?; + } + let note_prefix = format!("{} {}", "Note", i + 1); + let note_prefix_len = if self.notes.len() > 1 { + note_prefix.len() + } else { + 4 + }; + let mut lines = note.lines(); + if let Some(line) = lines.next() { + write_margin(&mut w, 0, false, false)?; + if self.notes.len() > 1 { + writeln!(w, "{}: {line}", note_prefix.fg(self.config.note_color(), s),)?; } else { - write_spacer_line(&mut w)?; + writeln!(w, "{}: {line}", "Note".fg(self.config.note_color(), s))?; } } + for line in lines { + write_margin(&mut w, 0, false, false)?; + writeln!(w, "{:>pad$}{line}", "", pad = note_prefix_len + 2)?; + } } + + // Tail of report. + // Not to be emitted in compact mode, or if nothing has had the margin printed. + if !self.config.compact + && !(groups_len == 0 && self.help.is_none() && self.notes.is_empty()) + { + writeln!( + w, + "{}", + format_args!("{}{}", Rept(draw.hbar, line_num_width + 2), draw.rbot) + .fg(self.config.margin_color(), s) + )?; + } + Ok(()) } } From 2ea74f45115233db58b7374efb1c4e8f2707bb80 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 15:38:26 +0200 Subject: [PATCH 35/38] Iterate on groups by ref instead of by value Then, we can avoid holding onto the Vec's len across the whole loop --- src/write.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/write.rs b/src/write.rs index 5af9852..ce3c154 100644 --- a/src/write.rs +++ b/src/write.rs @@ -220,8 +220,7 @@ impl Report<'_, S> { }; // --- Source sections --- - let groups_len = groups.len(); - for (group_idx, group) in groups.into_iter().enumerate() { + for (group_idx, group) in groups.iter().enumerate() { let Some((src, src_name)) = fetch_source(&mut cache, group.src_id) else { // `fetch_source` should have reported the error. continue; @@ -828,7 +827,7 @@ impl Report<'_, S> { // Tail of report. // Not to be emitted in compact mode, or if nothing has had the margin printed. if !self.config.compact - && !(groups_len == 0 && self.help.is_none() && self.notes.is_empty()) + && !(groups.is_empty() && self.help.is_none() && self.notes.is_empty()) { writeln!( w, From 825d66e56ed6dcaca097de7ecd107174447eadab Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 15:39:40 +0200 Subject: [PATCH 36/38] Rearrange a bool expr like Clippy suggests --- src/write.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/write.rs b/src/write.rs index ce3c154..9b8ff42 100644 --- a/src/write.rs +++ b/src/write.rs @@ -826,8 +826,8 @@ impl Report<'_, S> { // Tail of report. // Not to be emitted in compact mode, or if nothing has had the margin printed. - if !self.config.compact - && !(groups.is_empty() && self.help.is_none() && self.notes.is_empty()) + if !(self.config.compact + || groups.is_empty() && self.help.is_none() && self.notes.is_empty()) { writeln!( w, From 05524fd2fde01234edac2c6c138cd84317c6329f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 15:45:47 +0200 Subject: [PATCH 37/38] Add a test for help and note but no labels --- src/write.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/write.rs b/src/write.rs index 9b8ff42..60d1feb 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1604,6 +1604,28 @@ mod tests { ") } + #[test] + fn only_help_and_note() { + let source = "this should not be printed"; + let msg = remove_trailing( + Report::build(ReportKind::Error, 0..0) + .with_config(no_color()) + .with_message("Programming language \"Rest\" not found") + .with_help("a language with a similar name exists: Rust") + .with_note("perhaps you'd like some sleep?") + .finish() + .write_to_string(Source::from(source)), + ); + assert_snapshot!(msg, @r###" + Error: Programming language "Rest" not found + │ + │ Help: a language with a similar name exists: Rust + │ + │ Note: perhaps you'd like some sleep? + ──╯ + "###) + } + #[test] fn multi_source() { let msg = remove_trailing( From 34fe426a64cebe79e6b44f3d6a5ae3b22c424456 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 30 May 2024 18:01:58 +0200 Subject: [PATCH 38/38] Do not apply the report kind's colour to its colon For consistency with other crates, and `Note` and `Help`. --- src/write.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/write.rs b/src/write.rs index 60d1feb..4b79255 100644 --- a/src/write.rs +++ b/src/write.rs @@ -175,8 +175,8 @@ impl Report<'_, S> { let kind_color = self.kind.color(&self.config); writeln!( w, - "{} {}", - format_args!("{}{}:", Show(code), self.kind).fg(kind_color, s), + "{}: {}", + format_args!("{}{}", Show(code), self.kind).fg(kind_color, s), Show(self.msg.as_ref()) )?;