Merge pull request #23700 from sorairolake/rename-trims
chore(std.mem): Rename `trimLeft` and `trimRight` to `trimStart` and `trimEnd`
This commit is contained in:
@@ -943,10 +943,10 @@ fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void {
|
||||
var cmd_cont: bool = false;
|
||||
var iter = std.mem.splitScalar(u8, trimmed_shell_content, '\n');
|
||||
while (iter.next()) |orig_line| {
|
||||
const line = mem.trimRight(u8, orig_line, " \r");
|
||||
const line = mem.trimEnd(u8, orig_line, " \r");
|
||||
if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] != '\\') {
|
||||
try out.writeAll("$ <kbd>");
|
||||
const s = std.mem.trimLeft(u8, line[1..], " ");
|
||||
const s = std.mem.trimStart(u8, line[1..], " ");
|
||||
if (escape) {
|
||||
try writeEscaped(out, s);
|
||||
} else {
|
||||
@@ -955,7 +955,7 @@ fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void {
|
||||
try out.writeAll("</kbd>" ++ "\n");
|
||||
} else if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] == '\\') {
|
||||
try out.writeAll("$ <kbd>");
|
||||
const s = std.mem.trimLeft(u8, line[1..], " ");
|
||||
const s = std.mem.trimStart(u8, line[1..], " ");
|
||||
if (escape) {
|
||||
try writeEscaped(out, s);
|
||||
} else {
|
||||
|
||||
@@ -1109,10 +1109,10 @@ fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void {
|
||||
var cmd_cont: bool = false;
|
||||
var iter = std.mem.splitScalar(u8, trimmed_shell_content, '\n');
|
||||
while (iter.next()) |orig_line| {
|
||||
const line = mem.trimRight(u8, orig_line, " \r");
|
||||
const line = mem.trimEnd(u8, orig_line, " \r");
|
||||
if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] != '\\') {
|
||||
try out.writeAll("$ <kbd>");
|
||||
const s = std.mem.trimLeft(u8, line[1..], " ");
|
||||
const s = std.mem.trimStart(u8, line[1..], " ");
|
||||
if (escape) {
|
||||
try writeEscaped(out, s);
|
||||
} else {
|
||||
@@ -1121,7 +1121,7 @@ fn printShell(out: anytype, shell_content: []const u8, escape: bool) !void {
|
||||
try out.writeAll("</kbd>" ++ "\n");
|
||||
} else if (!cmd_cont and line.len > 1 and mem.eql(u8, line[0..2], "$ ") and line[line.len - 1] == '\\') {
|
||||
try out.writeAll("$ <kbd>");
|
||||
const s = std.mem.trimLeft(u8, line[1..], " ");
|
||||
const s = std.mem.trimStart(u8, line[1..], " ");
|
||||
if (escape) {
|
||||
try writeEscaped(out, s);
|
||||
} else {
|
||||
|
||||
@@ -670,7 +670,7 @@ const Case = struct {
|
||||
if (std.mem.startsWith(u8, line, "#")) {
|
||||
var line_it = std.mem.splitScalar(u8, line, '=');
|
||||
const key = line_it.first()[1..];
|
||||
const val = std.mem.trimRight(u8, line_it.rest(), "\r"); // windows moment
|
||||
const val = std.mem.trimEnd(u8, line_it.rest(), "\r"); // windows moment
|
||||
if (val.len == 0) {
|
||||
fatal("line {d}: missing value", .{line_n});
|
||||
} else if (std.mem.eql(u8, key, "target")) {
|
||||
@@ -720,7 +720,7 @@ const Case = struct {
|
||||
|
||||
while (true) {
|
||||
const next_line_raw = it.peek() orelse fatal("line {d}: unexpected EOF", .{line_n});
|
||||
const next_line = std.mem.trimRight(u8, next_line_raw, "\r");
|
||||
const next_line = std.mem.trimEnd(u8, next_line_raw, "\r");
|
||||
if (std.mem.startsWith(u8, next_line, "#")) break;
|
||||
|
||||
_ = it.next();
|
||||
@@ -759,7 +759,7 @@ const Case = struct {
|
||||
if (!std.mem.startsWith(u8, next_line, "#")) break;
|
||||
var new_line_it = std.mem.splitScalar(u8, next_line, '=');
|
||||
const new_key = new_line_it.first()[1..];
|
||||
const new_val = std.mem.trimRight(u8, new_line_it.rest(), "\r");
|
||||
const new_val = std.mem.trimEnd(u8, new_line_it.rest(), "\r");
|
||||
if (new_val.len == 0) break;
|
||||
if (!std.mem.eql(u8, new_key, "expect_error")) break;
|
||||
|
||||
@@ -774,7 +774,7 @@ const Case = struct {
|
||||
if (!std.mem.startsWith(u8, next_line, "#")) break;
|
||||
var new_line_it = std.mem.splitScalar(u8, next_line, '=');
|
||||
const new_key = new_line_it.first()[1..];
|
||||
const new_val = std.mem.trimRight(u8, new_line_it.rest(), "\r");
|
||||
const new_val = std.mem.trimEnd(u8, new_line_it.rest(), "\r");
|
||||
if (new_val.len == 0) break;
|
||||
if (!std.mem.eql(u8, new_key, "expect_compile_log")) break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user