Skip to content

Commit

Permalink
fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
llogiq committed Nov 4, 2021
1 parent 7e4a897 commit 3fe4f75
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 28 deletions.
8 changes: 4 additions & 4 deletions dummy_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn hello_world(input: TokenStream) -> TokenStream {
let faker = if let Some(ref expr) = f.faker {
syn::parse_str::<syn::Expr>(expr).unwrap()
} else {
syn::parse_str::<syn::Expr>(&"fake::Faker").unwrap()
syn::parse_str::<syn::Expr>("fake::Faker").unwrap()
};
quote! {
(#faker).fake_with_rng::<#field_ty, _>(rng)
Expand Down Expand Up @@ -100,7 +100,7 @@ pub fn hello_world(input: TokenStream) -> TokenStream {
let faker = if let Some(ref expr) = f.faker {
syn::parse_str::<syn::Expr>(expr).unwrap()
} else {
syn::parse_str::<syn::Expr>(&"fake::Faker").unwrap()
syn::parse_str::<syn::Expr>("fake::Faker").unwrap()
};
quote! {
let #field_name: #field_ty = (#faker).fake_with_rng(rng);
Expand Down Expand Up @@ -145,7 +145,7 @@ pub fn hello_world(input: TokenStream) -> TokenStream {
let faker = if let Some(ref expr) = f.faker {
syn::parse_str::<syn::Expr>(expr).unwrap()
} else {
syn::parse_str::<syn::Expr>(&"fake::Faker").unwrap()
syn::parse_str::<syn::Expr>("fake::Faker").unwrap()
};
quote! {
(#faker).fake_with_rng::<#field_ty, _>(rng)
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn hello_world(input: TokenStream) -> TokenStream {
let faker = if let Some(ref expr) = f.faker {
syn::parse_str::<syn::Expr>(expr).unwrap()
} else {
syn::parse_str::<syn::Expr>(&"fake::Faker").unwrap()
syn::parse_str::<syn::Expr>("fake::Faker").unwrap()
};
quote! {
let #field_name: #field_ty = (#faker).fake_with_rng(rng);
Expand Down
2 changes: 1 addition & 1 deletion fake/src/faker/impls/automotive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn numerify_licence_plate<R: Rng + ?Sized>(string: &str, rng: &mut R) -> String
.collect()
}

const LICENSE_PLATE: &'static [&'static str] = &["$$-###-$$"];
const LICENSE_PLATE: &[&str] = &["$$-###-$$"];

impl Dummy<LicencePlate<FR_FR>> for String {
fn dummy_with_rng<R: Rng + ?Sized>(_: &LicencePlate<FR_FR>, rng: &mut R) -> Self {
Expand Down
6 changes: 3 additions & 3 deletions fake/src/faker/impls/barecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn get_properties<L: Data, R: Rng + ?Sized>(_c: L, rng: &mut R) -> IsbnPropertie
let group = keys.choose(rng).unwrap();

let reg_pub_len = ISBN_MAX_LENGTH - ean.chars().count() - group.chars().count() - 1;
let reg_pub = numerify_sym(&std::iter::repeat("#").take(reg_pub_len).collect::<String>(), rng);
let reg_pub = numerify_sym(&"#".repeat(reg_pub_len), rng);

let mut reg_len = 0;
let sufix_reg_pub = &reg_pub[..reg_pub_len as usize - 1];
Expand All @@ -91,8 +91,8 @@ fn get_properties<L: Data, R: Rng + ?Sized>(_c: L, rng: &mut R) -> IsbnPropertie
}
}
IsbnProperties {
ean: ean,
group: group,
ean,
group,
registrant: reg_pub[..reg_len as usize].to_string(),
publication: reg_pub[reg_len as usize..reg_pub_len as usize].to_string()
}
Expand Down
4 changes: 1 addition & 3 deletions fake/src/faker/impls/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1921,9 +1921,7 @@ impl<L: Data> Dummy<DirPath<L>> for String {
}
}

const UNSTABLE_SEMVER: &'static [&'static str] = &[
"alpha", "beta", "rc"
];
const UNSTABLE_SEMVER: &[&str] = &["alpha", "beta", "rc"];

impl<L: Data> Dummy<Semver<L>> for String {
fn dummy_with_rng<R: Rng + ?Sized>(_: &Semver<L>, rng: &mut R) -> Self {
Expand Down
6 changes: 3 additions & 3 deletions fake/src/locales/ja_jp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ impl Data for JA_JP {
"新井",
];
const NAME_TITLE: &'static [&'static str] = &["様"];
const NAME_TPL: &'static str = &"{LastName} {FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = &"{LastName}{FirstName}{Title}";
const NAME_TPL: &'static str = "{LastName} {FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = "{LastName}{FirstName}{Title}";

const JOB_SENIORITY: &'static [&'static str] = &[
"リード",
Expand Down Expand Up @@ -385,7 +385,7 @@ impl Data for JA_JP {
"代表",
"ストラテジスト",
];
const JOB_TITLE_TPL: &'static str = &"{Seniority}{Field}{Position}";
const JOB_TITLE_TPL: &'static str = "{Seniority}{Field}{Position}";

const COMPANY_SUFFIX: &'static [&'static str] = &["株式会社", "(株)", "有限会社", "(有)"];
const COMPANY_NAME_TPLS: &'static [&'static str] = &["{Name_1} {Suffix}", "{Suffix} {Name_1}"];
Expand Down
18 changes: 9 additions & 9 deletions fake/src/locales/mod.rs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions fake/src/locales/zh_cn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ impl Data for ZH_CN {
"万", "钱", "严", "覃", "武", "戴", "莫", "孔", "向", "汤", "欧阳",
];
const NAME_TITLE: &'static [&'static str] = &["先生", "小姐", "男士", "女士"];
const NAME_TPL: &'static str = &"{LastName}{FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = &"{LastName}{FirstName}{Title}";
const NAME_TPL: &'static str = "{LastName}{FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = "{LastName}{FirstName}{Title}";

const JOB_SENIORITY: &'static [&'static str] =
&["领导级", "高级", "初级", "首席级", "负责人级"];
Expand Down Expand Up @@ -101,5 +101,5 @@ impl Data for ZH_CN {
"代表",
"战略家",
];
const JOB_TITLE_TPL: &'static str = &"{Seniority} {Field} {Position}";
const JOB_TITLE_TPL: &'static str = "{Seniority} {Field} {Position}";
}
4 changes: 2 additions & 2 deletions fake/src/locales/zh_tw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ impl Data for ZH_TW {
"仲孫", "軒轅", "令狐", "徐離", "宇文", "長孫", "慕容", "司徒", "司空",
];
const NAME_TITLE: &'static [&'static str] = &["先生", "夫人", "女士", "小姐", "博士"];
const NAME_TPL: &'static str = &"{LastName}{FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = &"{LastName}{FirstName}{Title}";
const NAME_TPL: &'static str = "{LastName}{FirstName}";
const NAME_WITH_TITLE_TPL: &'static str = "{LastName}{FirstName}{Title}";
}

0 comments on commit 3fe4f75

Please sign in to comment.