Skip to content

Commit

Permalink
Use .into() instead of From:: for straightforward field copying
Browse files Browse the repository at this point in the history
  • Loading branch information
echeran committed Sep 2, 2022
1 parent 6442d95 commit 60d3e3e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ffi/diplomat/src/collator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,13 @@ impl From<ffi::ICU4XCollatorBackwardSecondLevel> for Option<BackwardSecondLevel>
impl From<ffi::ICU4XCollatorOptions> for CollatorOptions {
fn from(options: ffi::ICU4XCollatorOptions) -> CollatorOptions {
let mut result = CollatorOptions::new();
result.strength = Option::<Strength>::from(options.strength);
result.alternate_handling = Option::<AlternateHandling>::from(options.alternate_handling);
result.case_first = Option::<CaseFirst>::from(options.case_first);
result.max_variable = Option::<MaxVariable>::from(options.max_variable);
result.case_level = Option::<CaseLevel>::from(options.case_level);
result.numeric = Option::<Numeric>::from(options.numeric);
result.backward_second_level =
Option::<BackwardSecondLevel>::from(options.backward_second_level);
result.strength = options.strength.into();
result.alternate_handling = options.alternate_handling.into();
result.case_first = options.case_first.into();
result.max_variable = options.max_variable.into();
result.case_level = options.case_level.into();
result.numeric = options.numeric.into();
result.backward_second_level = options.backward_second_level.into();

result
}
Expand Down

0 comments on commit 60d3e3e

Please sign in to comment.