Skip to content

Commit

Permalink
Fixed clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mazznoer committed Aug 29, 2021
1 parent cb30e4f commit a0e0671
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ impl Color {
#[deprecated]
/// Blend this color with the other one, in the linear RGB color-space. `t` in the range [0..1].
pub fn interpolate_lrgb(&self, other: &Color, t: f64) -> Color {
self.interpolate_linear_rgb(&other, t)
self.interpolate_linear_rgb(other, t)
}

/// Blend this color with the other one, in the HSV color-space. `t` in the range [0..1].
Expand Down
8 changes: 4 additions & 4 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ pub fn parse(s: &str) -> Result<Color, ParseColorError> {
}

// Hex format
if let Some(s) = s.strip_prefix("#") {
if let Some(s) = s.strip_prefix('#') {
if let Ok(c) = parse_hex(s) {
return Ok(c);
}
return Err(ParseColorError::InvalidHex);
}

if let (Some(i), Some(s)) = (s.find('('), s.strip_suffix(")")) {
if let (Some(i), Some(s)) = (s.find('('), s.strip_suffix(')')) {
let fname = &s[..i].trim_end();
let s = &s[i + 1..].replace(",", " ").replace("/", " ");
let params = s.split_whitespace().collect::<Vec<&str>>();
Expand Down Expand Up @@ -289,7 +289,7 @@ fn parse_hex(s: &str) -> Result<Color, Box<dyn error::Error>> {
}

fn parse_percent_or_float(s: &str) -> Option<f64> {
if let Some(s) = s.strip_suffix("%") {
if let Some(s) = s.strip_suffix('%') {
if let Ok(t) = s.parse::<f64>() {
return Some(t / 100.0);
}
Expand All @@ -304,7 +304,7 @@ fn parse_percent_or_float(s: &str) -> Option<f64> {
}

fn parse_percent_or_255(s: &str) -> Option<f64> {
if let Some(s) = s.strip_suffix("%") {
if let Some(s) = s.strip_suffix('%') {
if let Ok(t) = s.parse::<f64>() {
return Some(t / 100.0);
}
Expand Down

0 comments on commit a0e0671

Please sign in to comment.