[librsvg: 32/43] angle: prefer explicit conversion
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 32/43] angle: prefer explicit conversion
- Date: Tue, 15 Oct 2019 00:08:10 +0000 (UTC)
commit bfddafb4ab53585c8fe5ecce42d5a84b873c07cf
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Oct 13 12:47:52 2019 +0200
angle: prefer explicit conversion
rsvg_internals/src/angle.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/angle.rs b/rsvg_internals/src/angle.rs
index dc702bcc..4fc10d35 100644
--- a/rsvg_internals/src/angle.rs
+++ b/rsvg_internals/src/angle.rs
@@ -3,7 +3,7 @@ use std::f64::consts::*;
use cssparser::{Parser, Token};
use crate::error::ValueErrorKind;
-use crate::parsers::{Parse, ParseError, finite_f32};
+use crate::parsers::{finite_f32, Parse, ParseError};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Angle(f64);
@@ -69,7 +69,10 @@ impl Parse for Angle {
.map_err(|_| ParseError::new("expected angle"))?;
match *token {
- Token::Number { value, .. } => Angle::from_degrees(finite_f32(value)? as f64),
+ Token::Number { value, .. } => {
+ let degrees = finite_f32(value)?;
+ Angle::from_degrees(f64::from(degrees))
+ }
Token::Dimension {
value, ref unit, ..
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]