1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibDiff: Port Diff::Hunk from DeprecatedString to String

Removing the last instance of DeprecatedString in this library! :^)
This commit is contained in:
Shannon Booth 2023-06-24 13:17:24 +12:00 committed by Andreas Kling
parent 9dc92f19b8
commit d3a27eeaf2
3 changed files with 7 additions and 7 deletions

View file

@ -41,12 +41,12 @@ ErrorOr<Vector<Hunk>> parse_hunks(StringView diff)
hunk.target_start_line = current_location.target_start_line;
while (line_index < diff_lines.size() && diff_lines[line_index][0] == '-') {
TRY(hunk.removed_lines.try_append(diff_lines[line_index].substring_view(1, diff_lines[line_index].length() - 1)));
TRY(hunk.removed_lines.try_append(TRY(String::from_utf8(diff_lines[line_index].substring_view(1, diff_lines[line_index].length() - 1)))));
current_location.apply_offset(1, HunkLocation::LocationType::Original);
++line_index;
}
while (line_index < diff_lines.size() && diff_lines[line_index][0] == '+') {
TRY(hunk.added_lines.try_append(diff_lines[line_index].substring_view(1, diff_lines[line_index].length() - 1)));
TRY(hunk.added_lines.try_append(TRY(String::from_utf8(diff_lines[line_index].substring_view(1, diff_lines[line_index].length() - 1)))));
current_location.apply_offset(1, HunkLocation::LocationType::Target);
++line_index;
}