Compare commits

...

1 Commits

Author SHA1 Message Date
Ben Grant
a495cd8cb4 reduce banned words 2025-03-04 11:26:34 -08:00
6 changed files with 6 additions and 9 deletions

View File

@@ -573,7 +573,7 @@ pub const Style = union(enum) {
if (is_optional and !is_catch_all)
return log.fail("Optional parameters can only be catch-all (change to \"[[...{s}]]\" or remove extra brackets)", .{param_name}, start, len);
// Potential future proofing
if (std.mem.indexOfAny(u8, param_name, "?*{}()=:#,")) |bad_char_index|
if (bun.strings.indexOfAny(param_name, "?*{}()=:#,")) |bad_char_index|
return log.fail("Parameter name cannot contain \"{c}\"", .{param_name[bad_char_index]}, start + bad_char_index, 1);
if (has_ending_double_bracket and !is_optional)

View File

@@ -11,7 +11,6 @@ const mem = std.mem;
const Allocator = mem.Allocator;
const stackFallback = std.heap.stackFallback;
const assert = std.debug.assert;
const print = std.debug.print;
/// Comptime diff configuration. Defaults are usually sufficient.
pub const Options = struct {
@@ -600,9 +599,6 @@ test StrDiffer {
}
var d = try StrDiffer.diff(a, actual.items, expected.items);
defer d.deinit();
for (d.items) |diff| {
std.debug.print("{}\n", .{diff});
}
}
}

View File

@@ -3748,6 +3748,7 @@ pub const libdeflate = @import("./deps/libdeflate.zig");
pub const bake = @import("bake/bake.zig");
/// like std.enums.tagName, except it doesn't lose the sentinel value.
/// delete this if https://github.com/ziglang/zig/pull/23083 lands
pub fn tagName(comptime Enum: type, value: Enum) ?[:0]const u8 {
return inline for (@typeInfo(Enum).@"enum".fields) |f| {
if (@intFromEnum(value) == f.value) break f.name;

View File

@@ -3070,7 +3070,7 @@ pub fn parse_attribute_selector(comptime Impl: type, parser: *SelectorParser, in
};
const never_matches = switch (operator) {
.equal, .dash_match => false,
.includes => value_str.len == 0 or std.mem.indexOfAny(u8, value_str, SELECTOR_WHITESPACE) != null,
.includes => value_str.len == 0 or bun.strings.indexOfAny(value_str, SELECTOR_WHITESPACE) != null,
.prefix, .substring, .suffix => value_str.len == 0,
};

View File

@@ -882,7 +882,7 @@ pub const Resolver = struct {
// Fragments in URLs in CSS imports are technically expected to work
if (tmp == .not_found and kind.isFromCSS()) try_without_suffix: {
// If resolution failed, try again with the URL query and/or hash removed
const maybe_suffix = std.mem.indexOfAny(u8, import_path, "?#");
const maybe_suffix = bun.strings.indexOfAny(import_path, "?#");
if (maybe_suffix == null or maybe_suffix.? < 1)
break :try_without_suffix;

View File

@@ -7,8 +7,8 @@ const words: Record<string, { reason: string; limit?: number; regex?: boolean }>
'@import("root").bun.': { reason: "Only import 'bun' once" },
"std.debug.assert": { reason: "Use bun.assert instead", limit: 25 },
"std.debug.dumpStackTrace": { reason: "Use bun.handleErrorReturnTrace or bun.crash_handler.dumpStackTrace instead" },
"std.debug.print": { reason: "Don't let this be committed", limit: 2 },
"std.mem.indexOfAny(u8": { reason: "Use bun.strings.indexOfAny", limit: 3 },
"std.debug.print": { reason: "Don't let this be committed" },
"std.mem.indexOfAny(u8": { reason: "Use bun.strings.indexOfAny" },
"undefined != ": { reason: "This is by definition Undefined Behavior." },
"undefined == ": { reason: "This is by definition Undefined Behavior." },
"bun.toFD(std.fs.cwd().fd)": { reason: "Use bun.FD.cwd()" },