1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +00:00

Everywhere: Use _{short_,}string to create Strings from literals

This commit is contained in:
Linus Groh 2023-02-25 16:40:37 +01:00
parent 85414d9338
commit 09d40bfbb2
92 changed files with 334 additions and 310 deletions

View file

@ -464,7 +464,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req
// 4. Else if keyLocaleData contains "true", then
else if (key_locale_data.contains_slow("true"sv)) {
// a. Let value be "true".
value = TRY_OR_THROW_OOM(vm, String::from_utf8("true"sv));
value = TRY_OR_THROW_OOM(vm, "true"_string);
// b. Let supportedExtensionAddition be the string-concatenation of "-" and key.
supported_extension_addition = ::Locale::Keyword { TRY_OR_THROW_OOM(vm, String::from_utf8(key)), {} };
@ -487,7 +487,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req
// 3. If optionsValue is the empty String, then
if (options_value->is_empty()) {
// a. Let optionsValue be "true".
options_value = TRY_OR_THROW_OOM(vm, String::from_utf8("true"sv));
options_value = TRY_OR_THROW_OOM(vm, "true"_string);
}
}

View file

@ -83,7 +83,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
// 21. Let collation be r.[[co]].
// 22. If collation is null, let collation be "default".
// 23. Set collator.[[Collation]] to collation.
collator.set_collation(result.co.has_value() ? result.co.release_value() : TRY_OR_THROW_OOM(vm, String::from_utf8("default"sv)));
collator.set_collation(result.co.has_value() ? result.co.release_value() : TRY_OR_THROW_OOM(vm, "default"_string));
// 24. If relevantExtensionKeys contains "kn", then
if (relevant_extension_keys.span().contains_slow("kn"sv) && result.kn.has_value()) {

View file

@ -1241,7 +1241,7 @@ ThrowCompletionOr<RawFormatResult> to_raw_fixed(VM& vm, MathematicalValue const&
// 7. If n = 0, let m be "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
result.formatted_string = n.is_zero()
? String::from_utf8_short_string("0"sv)
? "0"_short_string
: MUST_OR_THROW_OOM(n.to_string(vm));
// 8. If f ≠ 0, then