Skip to content

Commit

Permalink
Remove forced u8 repr and rename types
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Dec 12, 2022
1 parent 08316e7 commit e11fd6b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
8 changes: 4 additions & 4 deletions boa_engine/src/builtins/intl/collator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl std::fmt::Debug for Collator {
}

#[derive(Debug, Clone)]
pub(in crate::builtins::intl) struct CollatorOptions {
pub(in crate::builtins::intl) struct CollatorLocaleOptions {
collation: Option<Value>,
numeric: Option<bool>,
case_first: Option<CaseFirst>,
Expand All @@ -87,9 +87,9 @@ where
{
type LangMarker = CollationMetadataV1Marker;

type Options = CollatorOptions;
type LocaleOptions = CollatorLocaleOptions;

fn resolve(locale: &mut Locale, options: &mut Self::Options, provider: &P) {
fn resolve(locale: &mut Locale, options: &mut Self::LocaleOptions, provider: &P) {
let collation = options
.collation
.take()
Expand Down Expand Up @@ -242,7 +242,7 @@ impl Collator {

let mut intl_options = IntlOptions {
matcher,
service_options: CollatorOptions {
service_options: CollatorLocaleOptions {
collation,
numeric,
case_first,
Expand Down
2 changes: 0 additions & 2 deletions boa_engine/src/builtins/intl/collator/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use icu_collator::{CaseLevel, Strength};
use crate::builtins::intl::options::OptionTypeParsable;

#[derive(Debug, Clone, Copy)]
#[repr(u8)]
pub(crate) enum Sensitivity {
Base,
Accent,
Expand Down Expand Up @@ -52,7 +51,6 @@ impl FromStr for Sensitivity {
impl OptionTypeParsable for Sensitivity {}

#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
#[repr(u8)]
pub(crate) enum Usage {
#[default]
Sort,
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/intl/list_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl std::fmt::Debug for ListFormat {
impl<P> Service<P> for ListFormat {
type LangMarker = AndListV1Marker;

type Options = ();
type LocaleOptions = ();
}

impl BuiltIn for ListFormat {
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/builtins/intl/list_format/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
};

#[derive(Debug, Clone, Copy, Default)]
#[repr(u8)]
pub(crate) enum ListFormatType {
#[default]
Conjunction,
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/builtins/intl/locale/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ where
{
type LangMarker = CardinalV1Marker;

type Options = TestOptions;
type LocaleOptions = TestOptions;

fn resolve(locale: &mut Locale, options: &mut Self::Options, provider: &P) {
fn resolve(locale: &mut Locale, options: &mut Self::LocaleOptions, provider: &P) {
let loc_hc = locale
.extensions
.unicode
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/intl/locale/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fn best_fit_matcher<M: KeyedDataMarker>(
/// [spec]: https://tc39.es/ecma402/#sec-resolvelocale
pub(in crate::builtins::intl) fn resolve_locale<S, P>(
requested_locales: &[Locale],
options: &mut IntlOptions<S::Options>,
options: &mut IntlOptions<S::LocaleOptions>,
icu: &Icu<P>,
) -> Locale
where
Expand Down
5 changes: 3 additions & 2 deletions boa_engine/src/builtins/intl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ trait Service<P> {

/// The set of options used in the [`Service::resolve`] method to resolve the provided
/// locale.
type Options;
type LocaleOptions;

/// Resolves the final value of `locale` from a set of `options`.
///
Expand All @@ -145,5 +145,6 @@ trait Service<P> {
/// new final values.
/// - If the implementor service doesn't contain any `[[RelevantExtensionKeys]]`, this can be
/// skipped.
fn resolve(_locale: &mut icu_locid::Locale, _options: &mut Self::Options, _provider: &P) {}
fn resolve(_locale: &mut icu_locid::Locale, _options: &mut Self::LocaleOptions, _provider: &P) {
}
}

0 comments on commit e11fd6b

Please sign in to comment.