Skip to content

Commit

Permalink
Merge pull request #38 from thevilx/fixClipyWarning
Browse files Browse the repository at this point in the history
Fix clippy warnings
  • Loading branch information
ali77gh authored Jan 12, 2024
2 parents 5237437 + f544be4 commit 9bcd5dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
16 changes: 6 additions & 10 deletions src/extract_card_number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ pub fn extract_card_number(inp: impl AsRef<str>) -> Vec<ExtractedCardNumber> {
for c in inp.chars() {
let converted = convert(c);

if converted.is_digit(10) {
if converted.is_ascii_digit() {
base.push(converted);
pure.push(c);
} else {
if c != '-' && c != ' ' {
base.clear();
pure.clear();
} else {
if !pure.is_empty() {
pure.push(c);
}
}
} else if c != '-' && c != ' ' {
base.clear();
pure.clear();
} else if !pure.is_empty() {
pure.push(c);
}

if base.len() == 16 {
Expand Down
2 changes: 1 addition & 1 deletion src/time_ago/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn time_ago(datetime: Option<impl AsRef<str>>) -> Result<String, TimeAgoErro

let elapsed = ts_now - ts;

if elapsed <= 1 && elapsed >= -1 {
if (-1..=1).contains(&elapsed) {
return Ok("اکنون".to_string());
}

Expand Down
4 changes: 2 additions & 2 deletions src/url_fix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use urlencoding::decode;
/// separator: space by default <br>
///
/// Example:<br>
/// url_fix('https://fa.wikipedia.org/wiki/%D9%85%DA%A9%D8%A7%D9%86%DB%8C%DA%A9%20%DA%A9%D9%88%D8%A7%D9%86%D8%AA%D9%88%D9%85%DB%8C', '_');<br>
/// return 'https://fa.wikipedia.org/wiki/مکانیک_کوانتومی'<br>
/// url_fix('<https://fa.wikipedia.org/wiki/%D9%85%DA%A9%D8%A7%D9%86%DB%8C%DA%A9%20%DA%A9%D9%88%D8%A7%D9%86%D8%AA%D9%88%D9%85%DB%8C>', '_');<br>
/// return '<https://fa.wikipedia.org/wiki/مکانیک_کوانتومی>'<br>
/// @return {string} a string of fixed URL
pub fn url_fix<S>(url: S, separator: Option<S>) -> String
where
Expand Down

0 comments on commit 9bcd5dc

Please sign in to comment.