Skip to content

Commit

Permalink
Pass trivial value as reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibi Braniecki committed Oct 26, 2018
1 parent 3784e20 commit f0145d5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion intl_pluralrules/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl IntlPluralRules {
/// assert_eq!(pr_broken.is_err(), !pr_broken.is_ok());
/// ```
pub fn create(lang: &str, prt: PluralRuleType) -> Result<Self, &'static str> {
let returned_rule = rules::get_pr(lang, &prt);
let returned_rule = rules::get_pr(lang, prt);
match returned_rule {
Ok(returned_rule) => Ok(Self {
locale: lang.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion intl_pluralrules/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn get_locales(pr_type: PluralRuleType) -> &'static [&'static str] {
}
}
#[cfg_attr(tarpaulin, skip)]
pub fn get_pr(lang_code: &str, pr_type: &PluralRuleType) -> Result<PluralRule, ()> {
pub fn get_pr(lang_code: &str, pr_type: PluralRuleType) -> Result<PluralRule, ()> {
match pr_type {
PluralRuleType::CARDINAL => {
static LANGUAGES: phf::Map<&'static str, PluralRule> = ::phf::Map {
Expand Down
2 changes: 1 addition & 1 deletion make_pluralrules/src/parser/gen_rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn gen_fn(
}
let filling = quote!{ #(#tokens),* };
let get_pr_function =
quote! { #[cfg_attr(tarpaulin, skip)] pub fn get_pr(lang_code: &str, pr_type: &PluralRuleType) -> Result<PluralRule, ()> {match pr_type { #filling }} };
quote! { #[cfg_attr(tarpaulin, skip)] pub fn get_pr(lang_code: &str, pr_type: PluralRuleType) -> Result<PluralRule, ()> {match pr_type { #filling }} };
quote! { #head #get_pr_function }
}

Expand Down
2 changes: 1 addition & 1 deletion make_pluralrules/tests/fixtures/cldr_pluralrules_33.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
# ! [ allow ( unused_variables , unused_parens ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: float_cmp ) ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: unreadable_literal ) ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: nonminimal_bool ) ) ] extern crate matches ; use phf ; use super :: operands :: PluralOperands ; use super :: { PluralCategory , PluralRuleType } ; pub type PluralRule = fn ( & PluralOperands ) -> PluralCategory ; pub static CLDR_VERSION : usize = 0 ; # [ cfg_attr ( tarpaulin , skip ) ] pub fn get_locales ( pr_type : PluralRuleType ) -> & 'static [ & 'static str ] { match pr_type { PluralRuleType :: CARDINAL => & [ "test" ] } } # [ cfg_attr ( tarpaulin , skip ) ] pub fn get_pr ( lang_code : & str , pr_type : & PluralRuleType ) -> Result < PluralRule , ( ) > { match pr_type { PluralRuleType :: CARDINAL => { static LANGUAGES : phf :: Map < & 'static str , PluralRule > = :: phf :: Map { key : 6246114685207409605 , disps : :: phf :: Slice :: Static ( & [ ( 0 , 0 ) , ] ) , entries : :: phf :: Slice :: Static ( & [ ( "test" , { fn rule_test ( po : & PluralOperands ) -> PluralCategory { if ( 2 . 0 <= po . n && po . n <= 10 . 0 && 8 > po . i && po . i > 9 ) { PluralCategory :: FEW } else if ( po . n == 1 . 0 ) { PluralCategory :: ONE } else if ( 1 <= po . i % 10 && po . i % 10 <= 2 ) { PluralCategory :: TWO } else { PluralCategory :: OTHER } } ; rule_test } ) , ] ) , } ; LANGUAGES . get ( lang_code ) . cloned ( ) . ok_or ( ( ) ) } } }
# ! [ allow ( unused_variables , unused_parens ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: float_cmp ) ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: unreadable_literal ) ) ] # ! [ cfg_attr ( feature = "cargo-clippy" , allow ( clippy :: nonminimal_bool ) ) ] extern crate matches ; use phf ; use super :: operands :: PluralOperands ; use super :: { PluralCategory , PluralRuleType } ; pub type PluralRule = fn ( & PluralOperands ) -> PluralCategory ; pub static CLDR_VERSION : usize = 0 ; # [ cfg_attr ( tarpaulin , skip ) ] pub fn get_locales ( pr_type : PluralRuleType ) -> & 'static [ & 'static str ] { match pr_type { PluralRuleType :: CARDINAL => & [ "test" ] } } # [ cfg_attr ( tarpaulin , skip ) ] pub fn get_pr ( lang_code : & str , pr_type : PluralRuleType ) -> Result < PluralRule , ( ) > { match pr_type { PluralRuleType :: CARDINAL => { static LANGUAGES : phf :: Map < & 'static str , PluralRule > = :: phf :: Map { key : 6246114685207409605 , disps : :: phf :: Slice :: Static ( & [ ( 0 , 0 ) , ] ) , entries : :: phf :: Slice :: Static ( & [ ( "test" , { fn rule_test ( po : & PluralOperands ) -> PluralCategory { if ( 2 . 0 <= po . n && po . n <= 10 . 0 && 8 > po . i && po . i > 9 ) { PluralCategory :: FEW } else if ( po . n == 1 . 0 ) { PluralCategory :: ONE } else if ( 1 <= po . i % 10 && po . i % 10 <= 2 ) { PluralCategory :: TWO } else { PluralCategory :: OTHER } } ; rule_test } ) , ] ) , } ; LANGUAGES . get ( lang_code ) . cloned ( ) . ok_or ( ( ) ) } } }

0 comments on commit f0145d5

Please sign in to comment.