[librsvg/alatiera/is-a-stream: 2/9] (440): Port rsvg_internals to Rust 2018
- From: Jordan Petridis <jpetridis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/alatiera/is-a-stream: 2/9] (440): Port rsvg_internals to Rust 2018
- Date: Sun, 31 Mar 2019 18:57:30 +0000 (UTC)
commit 8abf898d8c64c8eb7c25aeef0ce88ff3e69a2c34
Author: Jordan Petridis <jpetridis gnome org>
Date: Fri Mar 8 19:14:06 2019 +0100
(440): Port rsvg_internals to Rust 2018
Close #440
.rustfmt.toml | 1 +
librsvg_crate/tests/compare_surfaces.rs | 2 +-
librsvg_crate/tests/intrinsic-dimensions.rs | 8 +++-
librsvg_crate/tests/render_to_viewport.rs | 8 +---
rsvg_internals/Cargo.toml | 3 +-
rsvg_internals/src/allowed_url.rs | 2 +-
rsvg_internals/src/angle.rs | 4 +-
rsvg_internals/src/aspect_ratio.rs | 20 ++++-----
rsvg_internals/src/attributes.rs | 2 +-
rsvg_internals/src/bbox.rs | 2 +-
rsvg_internals/src/c_api.rs | 10 ++---
rsvg_internals/src/clip_path.rs | 17 ++++----
rsvg_internals/src/color.rs | 8 ++--
rsvg_internals/src/cond.rs | 4 +-
rsvg_internals/src/coord_units.rs | 4 +-
rsvg_internals/src/create_node.rs | 32 +++++++-------
rsvg_internals/src/css.rs | 14 +++----
rsvg_internals/src/drawing_ctx.rs | 42 +++++++++----------
rsvg_internals/src/error.rs | 4 +-
rsvg_internals/src/filters/blend.rs | 14 +++----
rsvg_internals/src/filters/bounds.rs | 8 ++--
rsvg_internals/src/filters/color_matrix.rs | 18 ++++----
rsvg_internals/src/filters/component_transfer.rs | 18 ++++----
rsvg_internals/src/filters/composite.rs | 18 ++++----
rsvg_internals/src/filters/context.rs | 20 ++++-----
rsvg_internals/src/filters/convolve_matrix.rs | 20 ++++-----
rsvg_internals/src/filters/displacement_map.rs | 14 +++----
rsvg_internals/src/filters/flood.rs | 8 ++--
rsvg_internals/src/filters/gaussian_blur.rs | 16 +++----
rsvg_internals/src/filters/image.rs | 24 +++++------
rsvg_internals/src/filters/input.rs | 6 +--
rsvg_internals/src/filters/light/light_source.rs | 14 +++----
rsvg_internals/src/filters/light/lighting.rs | 20 ++++-----
rsvg_internals/src/filters/light/mod.rs | 4 +-
rsvg_internals/src/filters/merge.rs | 12 +++---
rsvg_internals/src/filters/mod.rs | 20 ++++-----
rsvg_internals/src/filters/morphology.rs | 16 +++----
rsvg_internals/src/filters/node.rs | 20 ++++-----
rsvg_internals/src/filters/offset.rs | 18 ++++----
rsvg_internals/src/filters/tile.rs | 8 ++--
rsvg_internals/src/filters/turbulence.rs | 18 ++++----
rsvg_internals/src/font_props.rs | 32 ++++++++------
rsvg_internals/src/gradient.rs | 32 +++++++-------
rsvg_internals/src/handle.rs | 22 +++++-----
rsvg_internals/src/image.rs | 26 ++++++------
rsvg_internals/src/io.rs | 4 +-
rsvg_internals/src/iri.rs | 8 ++--
rsvg_internals/src/length.rs | 16 +++----
rsvg_internals/src/lib.rs | 49 ++++++----------------
rsvg_internals/src/link.rs | 10 ++---
rsvg_internals/src/log.rs | 2 +-
rsvg_internals/src/marker.rs | 34 +++++++--------
rsvg_internals/src/mask.rs | 24 +++++------
rsvg_internals/src/node.rs | 20 ++++-----
rsvg_internals/src/number_list.rs | 2 +-
rsvg_internals/src/paint_server.rs | 24 +++++------
rsvg_internals/src/parsers.rs | 6 +--
rsvg_internals/src/path_builder.rs | 4 +-
rsvg_internals/src/path_parser.rs | 2 +-
rsvg_internals/src/pattern.rs | 34 +++++++--------
rsvg_internals/src/pixbuf_utils.rs | 10 ++---
rsvg_internals/src/properties.rs | 34 +++++++--------
rsvg_internals/src/property_bag.rs | 2 +-
rsvg_internals/src/property_macros.rs | 32 +++++++-------
rsvg_internals/src/rect.rs | 2 +-
rsvg_internals/src/shapes.rs | 22 +++++-----
rsvg_internals/src/srgb.rs | 4 +-
rsvg_internals/src/stop.rs | 14 +++----
rsvg_internals/src/structure.rs | 30 ++++++-------
rsvg_internals/src/style.rs | 8 ++--
rsvg_internals/src/surface_utils/iterators.rs | 6 +--
rsvg_internals/src/surface_utils/shared_surface.rs | 6 +--
rsvg_internals/src/svg.rs | 20 ++++-----
rsvg_internals/src/text.rs | 26 ++++++------
rsvg_internals/src/transform.rs | 10 ++---
rsvg_internals/src/unit_interval.rs | 6 +--
rsvg_internals/src/viewbox.rs | 6 +--
rsvg_internals/src/xml.rs | 32 +++++++-------
rsvg_internals/src/xml2_load.rs | 16 +++----
79 files changed, 570 insertions(+), 588 deletions(-)
---
diff --git a/.rustfmt.toml b/.rustfmt.toml
index 3ff19eec..6192d8a7 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -12,3 +12,4 @@ normalize_comments = true
reorder_imports = true
use_field_init_shorthand = true
imports_layout = "HorizontalVertical"
+edition = "2018"
diff --git a/librsvg_crate/tests/compare_surfaces.rs b/librsvg_crate/tests/compare_surfaces.rs
index f592a071..dd291871 100644
--- a/librsvg_crate/tests/compare_surfaces.rs
+++ b/librsvg_crate/tests/compare_surfaces.rs
@@ -3,13 +3,13 @@ extern crate rsvg_internals;
use cairo::ImageSurface;
-use self::rsvg_internals::{IRect, RenderingError};
use self::rsvg_internals::surface_utils::{
iterators::Pixels,
shared_surface::{SharedImageSurface, SurfaceType},
ImageSurfaceDataExt,
Pixel,
};
+use self::rsvg_internals::{IRect, RenderingError};
pub enum BufferDiff {
DifferentSizes,
diff --git a/librsvg_crate/tests/intrinsic-dimensions.rs b/librsvg_crate/tests/intrinsic-dimensions.rs
index a132eb34..a80f6b4d 100644
--- a/librsvg_crate/tests/intrinsic-dimensions.rs
+++ b/librsvg_crate/tests/intrinsic-dimensions.rs
@@ -118,7 +118,9 @@ fn element_geometry_with_percent_viewport() {
height: 100.0,
};
- let (ink_r, logical_r) = renderer.geometry_for_element(Some("#foo"), &viewport).unwrap();
+ let (ink_r, logical_r) = renderer
+ .geometry_for_element(Some("#foo"), &viewport)
+ .unwrap();
let rect = cairo::Rectangle {
x: 10.0,
@@ -150,7 +152,9 @@ fn element_geometry_viewport_viewbox() {
height: 400.0,
};
- let (ink_r, logical_r) = renderer.geometry_for_element(Some("#two"), &viewport).unwrap();
+ let (ink_r, logical_r) = renderer
+ .geometry_for_element(Some("#two"), &viewport)
+ .unwrap();
let rect = cairo::Rectangle {
x: 0.0,
diff --git a/librsvg_crate/tests/render_to_viewport.rs b/librsvg_crate/tests/render_to_viewport.rs
index dd2d2c9c..f77d2160 100644
--- a/librsvg_crate/tests/render_to_viewport.rs
+++ b/librsvg_crate/tests/render_to_viewport.rs
@@ -7,11 +7,7 @@ extern crate rsvg_internals;
use gio::MemoryInputStreamExt;
use glib::Cast;
-use librsvg::{
- CairoRenderer,
- Loader,
- SvgHandle,
-};
+use librsvg::{CairoRenderer, Loader, SvgHandle};
use std::fs::File;
use std::io::BufReader;
@@ -21,7 +17,7 @@ use self::rsvg_internals::surface_utils::shared_surface::{SharedImageSurface, Su
mod compare_surfaces;
-use compare_surfaces::{compare_surfaces, BufferDiff};
+use crate::compare_surfaces::{compare_surfaces, BufferDiff};
fn load_svg(input: &'static [u8]) -> SvgHandle {
let stream = gio::MemoryInputStream::new();
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index 77182c39..568716ba 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.0.1"
authors = ["Federico Mena Quintero <federico gnome org>"]
workspace = "../"
build = "build.rs"
+edition = "2018"
# IMPORTANT: If you add/remove/update dependencies here, please also
# update Cargo.toml in https://gitlab.com/BuildStream/cargo-fetcher
@@ -81,4 +82,4 @@ harness = false
[features]
# Enables calling g_warning() when built as part of librsvg.so
-c-library = []
\ No newline at end of file
+c-library = []
diff --git a/rsvg_internals/src/allowed_url.rs b/rsvg_internals/src/allowed_url.rs
index f409fada..2ae4b490 100644
--- a/rsvg_internals/src/allowed_url.rs
+++ b/rsvg_internals/src/allowed_url.rs
@@ -5,7 +5,7 @@ use std::ops::Deref;
use std::path::{Path, PathBuf};
use url::{self, Url};
-use error::HrefError;
+use crate::error::HrefError;
/// Wrapper for URLs which are allowed to be loaded
///
diff --git a/rsvg_internals/src/angle.rs b/rsvg_internals/src/angle.rs
index 8998595d..897f3d16 100644
--- a/rsvg_internals/src/angle.rs
+++ b/rsvg_internals/src/angle.rs
@@ -2,8 +2,8 @@ use std::f64::consts::*;
use cssparser::{Parser, Token};
-use error::ValueErrorKind;
-use parsers::{Parse, ParseError};
+use crate::error::ValueErrorKind;
+use crate::parsers::{Parse, ParseError};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Angle(f64);
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index 1d0b9769..4ed6ff61 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -24,12 +24,12 @@ use std::ops::Deref;
use cairo::{self, MatrixTrait};
+use crate::error::ValueErrorKind;
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::parsers::Parse;
+use crate::parsers::ParseError;
+use crate::viewbox::ViewBox;
use cssparser::{CowRcStr, Parser};
-use error::ValueErrorKind;
-use float_eq_cairo::ApproxEqCairo;
-use parsers::Parse;
-use parsers::ParseError;
-use viewbox::ViewBox;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct AspectRatio {
@@ -222,16 +222,16 @@ impl Parse for AspectRatio {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<AspectRatio, ValueErrorKind> {
- let defer = parser.try(|p| p.expect_ident_matching("defer")).is_ok();
+ let defer = parser.r#try(|p| p.expect_ident_matching("defer")).is_ok();
- let align_xy = parser.try(|p| {
+ let align_xy = parser.r#try(|p| {
p.expect_ident()
.map_err(|_| ValueErrorKind::Parse(ParseError::new("expected identifier")))
.and_then(|ident| parse_align_xy(ident))
})?;
let fit = parser
- .try(|p| {
+ .r#try(|p| {
p.expect_ident()
.map_err(|_| ValueErrorKind::Parse(ParseError::new("expected identifier")))
.and_then(|ident| parse_fit_mode(ident))
@@ -251,9 +251,9 @@ impl Parse for AspectRatio {
#[cfg(test)]
mod tests {
use super::*;
+ use crate::float_eq_cairo::ApproxEqCairo;
+ use crate::rect::RectangleExt;
use cairo::Rectangle;
- use float_eq_cairo::ApproxEqCairo;
- use rect::RectangleExt;
#[test]
fn parsing_invalid_strings_yields_error() {
diff --git a/rsvg_internals/src/attributes.rs b/rsvg_internals/src/attributes.rs
index 05e4b641..1068b3d9 100644
--- a/rsvg_internals/src/attributes.rs
+++ b/rsvg_internals/src/attributes.rs
@@ -1,4 +1,4 @@
-extern crate phf;
+use phf;
use std::fmt;
use std::str::FromStr;
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index e4a80f96..4c76b805 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -1,7 +1,7 @@
use cairo;
use cairo::MatrixTrait;
-use rect::RectangleExt;
+use crate::rect::RectangleExt;
#[derive(Debug, Copy, Clone)]
pub struct BoundingBox {
diff --git a/rsvg_internals/src/c_api.rs b/rsvg_internals/src/c_api.rs
index b390dd74..b167d4dc 100644
--- a/rsvg_internals/src/c_api.rs
+++ b/rsvg_internals/src/c_api.rs
@@ -20,11 +20,11 @@ use glib::{ParamFlags, ParamSpec, StaticType, ToValue, Type, Value};
use glib_sys;
use gobject_sys::{self, GEnumValue, GFlagsValue};
-use dpi::Dpi;
-use drawing_ctx::RsvgRectangle;
-use error::{set_gerror, RSVG_ERROR_FAILED};
-use handle::{Handle, LoadFlags, LoadState};
-use length::RsvgLength;
+use crate::dpi::Dpi;
+use crate::drawing_ctx::RsvgRectangle;
+use crate::error::{set_gerror, RSVG_ERROR_FAILED};
+use crate::handle::{Handle, LoadFlags, LoadState};
+use crate::length::RsvgLength;
use url::Url;
mod handle_flags {
diff --git a/rsvg_internals/src/clip_path.rs b/rsvg_internals/src/clip_path.rs
index f85543f7..9b7a76b7 100644
--- a/rsvg_internals/src/clip_path.rs
+++ b/rsvg_internals/src/clip_path.rs
@@ -2,13 +2,13 @@ use std::cell::Cell;
use cairo::{self, MatrixTrait};
-use attributes::Attribute;
-use coord_units::CoordUnits;
-use drawing_ctx::DrawingCtx;
-use error::RenderingError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::ParseValue;
-use property_bag::PropertyBag;
+use crate::attributes::Attribute;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::RenderingError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::ParseValue;
+use crate::property_bag::PropertyBag;
coord_units!(ClipPathUnits, CoordUnits::UserSpaceOnUse);
@@ -48,8 +48,7 @@ impl NodeClipPath {
let rect = orig_bbox.rect.unwrap();
- let mut bbtransform =
- cairo::Matrix::new(rect.width, 0.0, 0.0, rect.height, rect.x, rect.y);
+ let bbtransform = cairo::Matrix::new(rect.width, 0.0, 0.0, rect.height, rect.x, rect.y);
cairo::Matrix::multiply(&bbtransform, affine_before_clip)
} else {
*affine_before_clip
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index a9e3015c..9531737f 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -1,10 +1,10 @@
use cssparser::{self, Parser};
use libc;
-use error::*;
-use parsers::Parse;
-use parsers::ParseError;
-use util::utf8_cstr;
+use crate::error::*;
+use crate::parsers::Parse;
+use crate::parsers::ParseError;
+use crate::util::utf8_cstr;
pub use cssparser::Color;
diff --git a/rsvg_internals/src/cond.rs b/rsvg_internals/src/cond.rs
index 24f5380c..63a67394 100644
--- a/rsvg_internals/src/cond.rs
+++ b/rsvg_internals/src/cond.rs
@@ -6,8 +6,8 @@ use std::str::FromStr;
use language_tags::LanguageTag;
use locale_config::{LanguageRange, Locale};
-use error::*;
-use parsers::ParseError;
+use crate::error::*;
+use crate::parsers::ParseError;
// No extensions at the moment.
static IMPLEMENTED_EXTENSIONS: &[&str] = &[];
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index 2d3e733d..31eed75e 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -1,7 +1,7 @@
use cssparser::{CowRcStr, Parser, Token};
-use error::ValueErrorKind;
-use parsers::{Parse, ParseError};
+use crate::error::ValueErrorKind;
+use crate::parsers::{Parse, ParseError};
/// Defines the units to be used for things that can consider a
/// coordinate system in terms of the current transformation, or in
diff --git a/rsvg_internals/src/create_node.rs b/rsvg_internals/src/create_node.rs
index 3e6a8b0e..cfcb1e0d 100644
--- a/rsvg_internals/src/create_node.rs
+++ b/rsvg_internals/src/create_node.rs
@@ -1,8 +1,8 @@
use std::collections::HashMap;
-use attributes::Attribute;
-use clip_path::NodeClipPath;
-use filters::{
+use crate::attributes::Attribute;
+use crate::clip_path::NodeClipPath;
+use crate::filters::{
blend::Blend,
color_matrix::ColorMatrix,
component_transfer::{ComponentTransfer, FuncX},
@@ -20,19 +20,19 @@ use filters::{
tile::Tile,
turbulence::Turbulence,
};
-use gradient::NodeGradient;
-use image::NodeImage;
-use link::NodeLink;
-use marker::NodeMarker;
-use mask::NodeMask;
-use node::*;
-use pattern::NodePattern;
-use property_bag::PropertyBag;
-use shapes::{NodeCircle, NodeEllipse, NodeLine, NodePath, NodePoly, NodeRect};
-use stop::NodeStop;
-use structure::{NodeDefs, NodeGroup, NodeSvg, NodeSwitch, NodeSymbol, NodeUse};
-use style::NodeStyle;
-use text::{NodeTRef, NodeTSpan, NodeText};
+use crate::gradient::NodeGradient;
+use crate::image::NodeImage;
+use crate::link::NodeLink;
+use crate::marker::NodeMarker;
+use crate::mask::NodeMask;
+use crate::node::*;
+use crate::pattern::NodePattern;
+use crate::property_bag::PropertyBag;
+use crate::shapes::{NodeCircle, NodeEllipse, NodeLine, NodePath, NodePoly, NodeRect};
+use crate::stop::NodeStop;
+use crate::structure::{NodeDefs, NodeGroup, NodeSvg, NodeSwitch, NodeSymbol, NodeUse};
+use crate::style::NodeStyle;
+use crate::text::{NodeTRef, NodeTSpan, NodeText};
macro_rules! node_create_fn {
($name:ident, $node_type:ident, $new_fn:expr) => {
diff --git a/rsvg_internals/src/css.rs b/rsvg_internals/src/css.rs
index dfa09da9..8d5ca8c0 100644
--- a/rsvg_internals/src/css.rs
+++ b/rsvg_internals/src/css.rs
@@ -9,13 +9,13 @@ use url::Url;
use glib::translate::*;
use glib_sys::{gboolean, gpointer, GList};
-use allowed_url::AllowedUrl;
-use attributes::Attribute;
-use croco::*;
-use error::LoadingError;
-use io::{self, BinaryData};
-use properties::SpecifiedValues;
-use util::utf8_cstr;
+use crate::allowed_url::AllowedUrl;
+use crate::attributes::Attribute;
+use crate::croco::*;
+use crate::error::LoadingError;
+use crate::io::{self, BinaryData};
+use crate::properties::SpecifiedValues;
+use crate::util::utf8_cstr;
struct Declaration {
prop_value: String,
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 132073e1..93c52b87 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -5,21 +5,21 @@ use glib::translate::*;
use std::cell::RefCell;
use std::rc::{Rc, Weak};
-use allowed_url::Fragment;
-use aspect_ratio::AspectRatio;
-use bbox::BoundingBox;
-use clip_path::{ClipPathUnits, NodeClipPath};
-use coord_units::CoordUnits;
-use dpi::Dpi;
-use error::RenderingError;
-use filters;
-use gradient::NodeGradient;
-use length::Dasharray;
-use mask::NodeMask;
-use node::{CascadedValues, NodeType, RsvgNode};
-use paint_server::{PaintServer, PaintSource};
-use pattern::NodePattern;
-use properties::{
+use crate::allowed_url::Fragment;
+use crate::aspect_ratio::AspectRatio;
+use crate::bbox::BoundingBox;
+use crate::clip_path::{ClipPathUnits, NodeClipPath};
+use crate::coord_units::CoordUnits;
+use crate::dpi::Dpi;
+use crate::error::RenderingError;
+use crate::filters;
+use crate::gradient::NodeGradient;
+use crate::length::Dasharray;
+use crate::mask::NodeMask;
+use crate::node::{CascadedValues, NodeType, RsvgNode};
+use crate::paint_server::{PaintServer, PaintSource};
+use crate::pattern::NodePattern;
+use crate::properties::{
ClipRule,
ComputedValues,
EnableBackground,
@@ -29,11 +29,11 @@ use properties::{
StrokeLinecap,
StrokeLinejoin,
};
-use rect::RectangleExt;
-use surface_utils::shared_surface::SharedImageSurface;
-use svg::Svg;
-use unit_interval::UnitInterval;
-use viewbox::ViewBox;
+use crate::rect::RectangleExt;
+use crate::surface_utils::shared_surface::SharedImageSurface;
+use crate::svg::Svg;
+use crate::unit_interval::UnitInterval;
+use crate::viewbox::ViewBox;
/// Holds values that are required to normalize `Length` values to a current viewport.
///
@@ -132,7 +132,7 @@ impl DrawingCtx {
(
cairo::Rectangle::new(0.0, 0.0, 1.0, 1.0),
ViewBox::new(0.0, 0.0, 1.0, 1.0),
- cairo::Matrix::identity()
+ cairo::Matrix::identity(),
)
} else {
let mut affine = cr.get_matrix();
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 65225d5a..79b068d1 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -9,8 +9,8 @@ use glib::translate::*;
use glib_sys;
use libc;
-use attributes::Attribute;
-use parsers::ParseError;
+use crate::attributes::Attribute;
+use crate::parsers::ParseError;
/// A simple error which refers to an attribute's value
#[derive(Debug, Clone, PartialEq)]
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 0a713447..a246c90b 100644
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -2,13 +2,13 @@ use std::cell::{Cell, RefCell};
use cairo;
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::ParseError;
-use property_bag::PropertyBag;
-use surface_utils::shared_surface::SharedImageSurface;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::ParseError;
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::shared_surface::SharedImageSurface;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
diff --git a/rsvg_internals/src/filters/bounds.rs b/rsvg_internals/src/filters/bounds.rs
index 806b95c9..9a6a9a10 100644
--- a/rsvg_internals/src/filters/bounds.rs
+++ b/rsvg_internals/src/filters/bounds.rs
@@ -1,10 +1,10 @@
//! Filter primitive subregion computation.
use cairo::{self, MatrixTrait};
-use bbox::BoundingBox;
-use drawing_ctx::DrawingCtx;
-use length::{LengthHorizontal, LengthVertical};
-use rect::IRect;
+use crate::bbox::BoundingBox;
+use crate::drawing_ctx::DrawingCtx;
+use crate::length::{LengthHorizontal, LengthVertical};
+use crate::rect::IRect;
use super::context::{FilterContext, FilterInput, FilterOutput};
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index 746dbd32..4c7668d3 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -3,20 +3,20 @@ use std::cell::RefCell;
use cairo::{self, ImageSurface};
use nalgebra::{Matrix3, Matrix4x5, Matrix5, Vector5};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use number_list::{NumberList, NumberListError, NumberListLength};
-use parsers::{self, ParseError};
-use property_bag::PropertyBag;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::number_list::{NumberList, NumberListError, NumberListLength};
+use crate::parsers::{self, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::SharedImageSurface,
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 61d9b3be..f557c596 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -3,20 +3,20 @@ use std::cmp::min;
use cairo::{self, ImageSurface};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
-use number_list::{NumberList, NumberListError, NumberListLength};
-use parsers::{self, ParseError};
-use property_bag::PropertyBag;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::number_list::{NumberList, NumberListError, NumberListLength};
+use crate::parsers::{self, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::SharedImageSurface,
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 12c385df..88e598e8 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -3,20 +3,20 @@ use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface};
use cssparser::{CowRcStr, Parser, Token};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::{NodeError, ValueErrorKind};
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{self, Parse, ParseValue};
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::{NodeError, ValueErrorKind};
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{self, Parse, ParseValue};
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::SharedImageSurface,
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
diff --git a/rsvg_internals/src/filters/context.rs b/rsvg_internals/src/filters/context.rs
index 0194c429..96b578dc 100644
--- a/rsvg_internals/src/filters/context.rs
+++ b/rsvg_internals/src/filters/context.rs
@@ -4,15 +4,15 @@ use std::f64;
use cairo::{self, MatrixTrait};
-use bbox::BoundingBox;
-use coord_units::CoordUnits;
-use drawing_ctx::{DrawingCtx, ViewParams};
-use node::RsvgNode;
-use paint_server::PaintServer;
-use properties::ComputedValues;
-use rect::IRect;
-use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
-use unit_interval::UnitInterval;
+use crate::bbox::BoundingBox;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::{DrawingCtx, ViewParams};
+use crate::node::RsvgNode;
+use crate::paint_server::PaintServer;
+use crate::properties::ComputedValues;
+use crate::rect::IRect;
+use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
+use crate::unit_interval::UnitInterval;
use super::error::FilterError;
use super::input::Input;
@@ -473,7 +473,7 @@ impl FilterInput {
#[cfg(test)]
mod tests {
use super::*;
- use surface_utils::iterators::Pixels;
+ use crate::surface_utils::iterators::Pixels;
#[test]
fn test_extract_alpha() {
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index 760d9b55..b5a45c52 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -3,22 +3,22 @@ use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface, MatrixTrait};
use nalgebra::{DMatrix, Dynamic, VecStorage};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use number_list::{NumberList, NumberListError, NumberListLength};
-use parsers::{self, ParseError};
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::number_list::{NumberList, NumberListError, NumberListLength};
+use crate::parsers::{self, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::{PixelRectangle, Pixels},
shared_surface::SharedImageSurface,
EdgeMode,
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index 385f63c5..84317536 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -2,13 +2,13 @@ use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface, MatrixTrait};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{self, ParseError};
-use property_bag::PropertyBag;
-use surface_utils::{iterators::Pixels, shared_surface::SharedImageSurface};
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{self, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::{iterators::Pixels, shared_surface::SharedImageSurface};
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, Input, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index 1355b4ff..8eeae3c5 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -1,10 +1,10 @@
use cairo::{self, ImageSurface};
use cssparser;
-use drawing_ctx::DrawingCtx;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use property_bag::PropertyBag;
-use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
+use crate::drawing_ctx::DrawingCtx;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, Primitive};
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index c387f9c9..661117aa 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -5,14 +5,14 @@ use std::f64;
use cairo::MatrixTrait;
use nalgebra::{DMatrix, Dynamic, VecStorage};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers;
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers;
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::{
shared_surface::{BlurDirection, Horizontal, SharedImageSurface, Vertical},
EdgeMode,
};
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 4b6e702f..b736a7ec 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -2,18 +2,18 @@ use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface, MatrixTrait, PatternTrait, Rectangle};
-use allowed_url::{Fragment, Href};
-use aspect_ratio::AspectRatio;
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::{NodeError, RenderingError};
-use float_eq_cairo::ApproxEqCairo;
-use node::{CascadedValues, NodeResult, NodeTrait, RsvgNode};
-use parsers::{ParseError, ParseValue};
-use property_bag::PropertyBag;
-use rect::{IRect, RectangleExt};
-use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
-use viewbox::ViewBox;
+use crate::allowed_url::{Fragment, Href};
+use crate::aspect_ratio::AspectRatio;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::{NodeError, RenderingError};
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::node::{CascadedValues, NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{ParseError, ParseValue};
+use crate::property_bag::PropertyBag;
+use crate::rect::{IRect, RectangleExt};
+use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
+use crate::viewbox::ViewBox;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, Primitive};
diff --git a/rsvg_internals/src/filters/input.rs b/rsvg_internals/src/filters/input.rs
index 60b3f18e..a3339c0c 100644
--- a/rsvg_internals/src/filters/input.rs
+++ b/rsvg_internals/src/filters/input.rs
@@ -1,6 +1,6 @@
-use attributes::Attribute;
-use error::NodeError;
-use parsers::ParseError;
+use crate::attributes::Attribute;
+use crate::error::NodeError;
+use crate::parsers::ParseError;
/// An enumeration of possible inputs for a filter primitive.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
diff --git a/rsvg_internals/src/filters/light/light_source.rs
b/rsvg_internals/src/filters/light/light_source.rs
index 96724bb7..b6c57858 100644
--- a/rsvg_internals/src/filters/light/light_source.rs
+++ b/rsvg_internals/src/filters/light/light_source.rs
@@ -4,13 +4,13 @@ use cairo::MatrixTrait;
use cssparser;
use nalgebra::Vector3;
-use attributes::Attribute;
-use error::NodeError;
-use filters::context::FilterContext;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers;
-use property_bag::PropertyBag;
-use util::clamp;
+use crate::attributes::Attribute;
+use crate::error::NodeError;
+use crate::filters::context::FilterContext;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers;
+use crate::property_bag::PropertyBag;
+use crate::util::clamp;
/// A light source node (`feDistantLight`, `fePointLight` or `feSpotLight`).
#[derive(Clone)]
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index e5f664a4..d046614b 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -7,10 +7,10 @@ use nalgebra::Vector3;
use num_traits::identities::Zero;
use rayon::prelude::*;
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use filters::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::filters::{
context::{FilterContext, FilterOutput, FilterResult},
light::{
bottom_left_normal,
@@ -29,16 +29,16 @@ use filters::{
FilterError,
PrimitiveWithInput,
};
-use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
-use parsers;
-use properties::ColorInterpolationFilters;
-use property_bag::PropertyBag;
-use surface_utils::{
+use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::parsers;
+use crate::properties::ColorInterpolationFilters;
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::{
shared_surface::{SharedImageSurface, SurfaceType},
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
/// Properties specific to either diffuse or specular lighting.
enum Data {
diff --git a/rsvg_internals/src/filters/light/mod.rs b/rsvg_internals/src/filters/light/mod.rs
index 69e579c7..e8df5bec 100644
--- a/rsvg_internals/src/filters/light/mod.rs
+++ b/rsvg_internals/src/filters/light/mod.rs
@@ -1,8 +1,8 @@
//! Light filters and nodes.
use nalgebra::Vector2;
-use rect::IRect;
-use surface_utils::shared_surface::SharedImageSurface;
+use crate::rect::IRect;
+use crate::surface_utils::shared_surface::SharedImageSurface;
pub mod light_source;
pub mod lighting;
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index 0765933b..6a832a61 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -2,12 +2,12 @@ use std::cell::RefCell;
use cairo::{self, ImageSurface};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index e34f88b2..ca8d1063 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -5,16 +5,16 @@ use std::time::Instant;
use cairo::{self, MatrixTrait};
use owning_ref::RcRef;
-use attributes::Attribute;
-use coord_units::CoordUnits;
-use drawing_ctx::DrawingCtx;
-use error::{RenderingError, ValueErrorKind};
-use length::{LengthHorizontal, LengthUnit, LengthVertical};
-use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
-use parsers::{ParseError, ParseValue};
-use properties::{ColorInterpolationFilters, ComputedValues};
-use property_bag::PropertyBag;
-use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
+use crate::attributes::Attribute;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::{RenderingError, ValueErrorKind};
+use crate::length::{LengthHorizontal, LengthUnit, LengthVertical};
+use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::parsers::{ParseError, ParseValue};
+use crate::properties::{ColorInterpolationFilters, ComputedValues};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
mod bounds;
use self::bounds::BoundsBuilder;
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index a168c916..954f75e5 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -3,14 +3,14 @@ use std::cmp::{max, min};
use cairo::{self, ImageSurface, MatrixTrait};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{self, ParseError};
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{self, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::{PixelRectangle, Pixels},
shared_surface::SharedImageSurface,
EdgeMode,
diff --git a/rsvg_internals/src/filters/node.rs b/rsvg_internals/src/filters/node.rs
index 7490946d..a4d0507a 100644
--- a/rsvg_internals/src/filters/node.rs
+++ b/rsvg_internals/src/filters/node.rs
@@ -3,16 +3,16 @@ use std::cell::Cell;
use cairo::{self, MatrixTrait};
-use attributes::Attribute;
-use bbox::BoundingBox;
-use coord_units::CoordUnits;
-use drawing_ctx::DrawingCtx;
-use error::ValueErrorKind;
-use length::{LengthHorizontal, LengthUnit, LengthVertical};
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{Parse, ParseError, ParseValue};
-use properties::ComputedValues;
-use property_bag::PropertyBag;
+use crate::attributes::Attribute;
+use crate::bbox::BoundingBox;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::ValueErrorKind;
+use crate::length::{LengthHorizontal, LengthUnit, LengthVertical};
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{Parse, ParseError, ParseValue};
+use crate::properties::ComputedValues;
+use crate::property_bag::PropertyBag;
/// The <filter> node.
pub struct NodeFilter {
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index 133999ec..5b3e233f 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -2,15 +2,15 @@ use std::cell::Cell;
use cairo::{self, ImageSurface, MatrixTrait};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers;
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::shared_surface::SharedImageSurface;
-use util::clamp;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers;
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::shared_surface::SharedImageSurface;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 76d8fa30..ddf1062c 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -1,9 +1,9 @@
use cairo::{self, ImageSurface, Matrix, MatrixTrait, PatternTrait};
-use drawing_ctx::DrawingCtx;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use property_bag::PropertyBag;
-use surface_utils::shared_surface::SharedImageSurface;
+use crate::drawing_ctx::DrawingCtx;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::shared_surface::SharedImageSurface;
use super::context::{FilterContext, FilterInput, FilterOutput, FilterResult};
use super::{Filter, FilterError, PrimitiveWithInput};
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index 30ac712b..ccba9871 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -2,19 +2,19 @@ use std::cell::Cell;
use cairo::{self, ImageSurface, MatrixTrait};
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::NodeError;
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{self, ParseError};
-use properties::ColorInterpolationFilters;
-use property_bag::PropertyBag;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::NodeError;
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{self, ParseError};
+use crate::properties::ColorInterpolationFilters;
+use crate::property_bag::PropertyBag;
+use crate::surface_utils::{
shared_surface::{SharedImageSurface, SurfaceType},
ImageSurfaceDataExt,
Pixel,
};
-use util::clamp;
+use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{Filter, FilterError, Primitive};
diff --git a/rsvg_internals/src/font_props.rs b/rsvg_internals/src/font_props.rs
index 6c7f354e..6d964d19 100644
--- a/rsvg_internals/src/font_props.rs
+++ b/rsvg_internals/src/font_props.rs
@@ -1,10 +1,10 @@
use cssparser::{BasicParseError, Parser, Token};
-use drawing_ctx::ViewParams;
-use error::*;
-use length::{LengthBoth, LengthHorizontal, LengthUnit, POINTS_PER_INCH};
-use parsers::{Parse, ParseError};
-use properties::ComputedValues;
+use crate::drawing_ctx::ViewParams;
+use crate::error::*;
+use crate::length::{LengthBoth, LengthHorizontal, LengthUnit, POINTS_PER_INCH};
+use crate::parsers::{Parse, ParseError};
+use crate::properties::ComputedValues;
// https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#propdef-font-size
#[derive(Debug, Copy, Clone, PartialEq)]
@@ -61,7 +61,7 @@ impl FontSizeSpec {
impl Parse for FontSizeSpec {
type Err = ValueErrorKind;
- fn parse(parser: &mut Parser<'_, '_>) -> Result<FontSizeSpec, ::error::ValueErrorKind> {
+ fn parse(parser: &mut Parser<'_, '_>) -> Result<FontSizeSpec, crate::error::ValueErrorKind> {
let parser_state = parser.state();
LengthBoth::parse(parser)
@@ -71,7 +71,9 @@ impl Parse for FontSizeSpec {
{
let token = parser.next().map_err(|_| {
- ::error::ValueErrorKind::Parse(::parsers::ParseError::new("expected token"))
+ crate::error::ValueErrorKind::Parse(crate::parsers::ParseError::new(
+ "expected token",
+ ))
})?;
if let Token::Ident(ref cow) = token {
@@ -118,8 +120,8 @@ pub enum FontWeightSpec {
impl Parse for FontWeightSpec {
type Err = ValueErrorKind;
- fn parse(parser: &mut Parser<'_, '_>) -> Result<FontWeightSpec, ::error::ValueErrorKind> {
- if let Ok(r) = parser.try(|p| {
+ fn parse(parser: &mut Parser<'_, '_>) -> Result<FontWeightSpec, crate::error::ValueErrorKind> {
+ if let Ok(r) = parser.r#try(|p| {
p.expect_ident()
.map_err(|_| ())
.and_then(|cow| match cow.as_ref() {
@@ -190,7 +192,9 @@ impl LetterSpacingSpec {
impl Parse for LetterSpacingSpec {
type Err = ValueErrorKind;
- fn parse(parser: &mut Parser<'_, '_>) -> Result<LetterSpacingSpec, ::error::ValueErrorKind> {
+ fn parse(
+ parser: &mut Parser<'_, '_>,
+ ) -> Result<LetterSpacingSpec, crate::error::ValueErrorKind> {
let parser_state = parser.state();
LengthHorizontal::parse(parser)
@@ -200,7 +204,9 @@ impl Parse for LetterSpacingSpec {
{
let token = parser.next().map_err(|_| {
- ::error::ValueErrorKind::Parse(::parsers::ParseError::new("expected token"))
+ crate::error::ValueErrorKind::Parse(crate::parsers::ParseError::new(
+ "expected token",
+ ))
})?;
if let Token::Ident(ref cow) = token {
@@ -234,7 +240,7 @@ impl Parse for SingleFontFamily {
fn parse_single_font_family<'i>(
parser: &'i mut Parser<'_, '_>,
) -> Result<SingleFontFamily, BasicParseError<'i>> {
- if let Ok(cow) = parser.try(|p| p.expect_string_cloned()) {
+ if let Ok(cow) = parser.r#try(|p| p.expect_string_cloned()) {
return Ok(SingleFontFamily((*cow).to_owned()));
}
@@ -242,7 +248,7 @@ fn parse_single_font_family<'i>(
let mut value = first_ident.as_ref().to_owned();
- while let Ok(cow) = parser.try(|p| p.expect_ident_cloned()) {
+ while let Ok(cow) = parser.r#try(|p| p.expect_ident_cloned()) {
value.push(' ');
value.push_str(&cow);
}
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 800fc6b5..266876f8 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -3,21 +3,21 @@ use cssparser::{self, CowRcStr, Parser, Token};
use std::cell::RefCell;
-use allowed_url::Fragment;
-use attributes::Attribute;
-use bbox::*;
-use coord_units::CoordUnits;
-use drawing_ctx::{AcquiredNode, DrawingCtx, NodeStack};
-use error::*;
-use length::*;
-use node::*;
-use paint_server::PaintSource;
-use parsers::{Parse, ParseError, ParseValue};
-use properties::{ComputedValues, StopColor};
-use property_bag::PropertyBag;
-use rect::RectangleExt;
-use stop::*;
-use unit_interval::UnitInterval;
+use crate::allowed_url::Fragment;
+use crate::attributes::Attribute;
+use crate::bbox::*;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::{AcquiredNode, DrawingCtx, NodeStack};
+use crate::error::*;
+use crate::length::*;
+use crate::node::*;
+use crate::paint_server::PaintSource;
+use crate::parsers::{Parse, ParseError, ParseValue};
+use crate::properties::{ComputedValues, StopColor};
+use crate::property_bag::PropertyBag;
+use crate::rect::RectangleExt;
+use crate::stop::*;
+use crate::unit_interval::UnitInterval;
#[derive(Copy, Clone)]
pub struct ColorStop {
@@ -717,7 +717,7 @@ impl NodeTrait for NodeGradient {
#[cfg(test)]
mod tests {
use super::*;
- use float_eq_cairo::ApproxEqCairo;
+ use crate::float_eq_cairo::ApproxEqCairo;
#[test]
fn parses_spread_method() {
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 7af18aa8..825ea364 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -11,18 +11,18 @@ use glib_sys;
use libc;
use locale_config::{LanguageRange, Locale};
-use allowed_url::{AllowedUrl, Href};
-use c_api::{RsvgDimensionData, RsvgPositionData, RsvgSizeFunc};
-use dpi::Dpi;
-use drawing_ctx::{DrawingCtx, RsvgRectangle};
-use error::{DefsLookupErrorKind, LoadingError, RenderingError};
-use node::RsvgNode;
-use pixbuf_utils::{empty_pixbuf, pixbuf_from_surface};
-use structure::{IntrinsicDimensions, NodeSvg};
-use surface_utils::{shared_surface::SharedImageSurface, shared_surface::SurfaceType};
-use svg::Svg;
+use crate::allowed_url::{AllowedUrl, Href};
+use crate::c_api::{RsvgDimensionData, RsvgPositionData, RsvgSizeFunc};
+use crate::dpi::Dpi;
+use crate::drawing_ctx::{DrawingCtx, RsvgRectangle};
+use crate::error::{DefsLookupErrorKind, LoadingError, RenderingError};
+use crate::node::RsvgNode;
+use crate::pixbuf_utils::{empty_pixbuf, pixbuf_from_surface};
+use crate::structure::{IntrinsicDimensions, NodeSvg};
+use crate::surface_utils::{shared_surface::SharedImageSurface, shared_surface::SurfaceType};
+use crate::svg::Svg;
+use crate::util::rsvg_g_warning;
use url::Url;
-use util::rsvg_g_warning;
/// Flags used during loading
///
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index c82e192e..0d9c17e0 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -2,19 +2,19 @@ use cairo;
use cairo::{PatternTrait, Rectangle};
use std::cell::{Cell, RefCell};
-use allowed_url::Href;
-use aspect_ratio::AspectRatio;
-use attributes::Attribute;
-use bbox::BoundingBox;
-use drawing_ctx::{ClipMode, DrawingCtx};
-use error::{NodeError, RenderingError};
-use float_eq_cairo::ApproxEqCairo;
-use length::{LengthHorizontal, LengthVertical};
-use node::*;
-use parsers::{ParseError, ParseValue};
-use property_bag::PropertyBag;
-use rect::RectangleExt;
-use viewbox::ViewBox;
+use crate::allowed_url::Href;
+use crate::aspect_ratio::AspectRatio;
+use crate::attributes::Attribute;
+use crate::bbox::BoundingBox;
+use crate::drawing_ctx::{ClipMode, DrawingCtx};
+use crate::error::{NodeError, RenderingError};
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::length::{LengthHorizontal, LengthVertical};
+use crate::node::*;
+use crate::parsers::{ParseError, ParseValue};
+use crate::property_bag::PropertyBag;
+use crate::rect::RectangleExt;
+use crate::viewbox::ViewBox;
pub struct NodeImage {
aspect: Cell<AspectRatio>,
diff --git a/rsvg_internals/src/io.rs b/rsvg_internals/src/io.rs
index 7c937e6c..72b5239f 100644
--- a/rsvg_internals/src/io.rs
+++ b/rsvg_internals/src/io.rs
@@ -15,8 +15,8 @@ use gio::{
};
use glib::{self, Bytes as GBytes, Cast};
-use allowed_url::AllowedUrl;
-use error::{LoadingError, RsvgError};
+use crate::allowed_url::AllowedUrl;
+use crate::error::{LoadingError, RsvgError};
pub struct BinaryData {
pub data: Vec<u8>,
diff --git a/rsvg_internals/src/iri.rs b/rsvg_internals/src/iri.rs
index 92ff5c97..7e785891 100644
--- a/rsvg_internals/src/iri.rs
+++ b/rsvg_internals/src/iri.rs
@@ -1,8 +1,8 @@
use cssparser::Parser;
-use allowed_url::{Fragment, Href};
-use parsers::Parse;
-use parsers::ParseError;
+use crate::allowed_url::{Fragment, Href};
+use crate::parsers::Parse;
+use crate::parsers::ParseError;
/// Used where style properties take a funciri or "none"
///
@@ -36,7 +36,7 @@ impl Parse for IRI {
type Err = ParseError;
fn parse(parser: &mut Parser<'_, '_>) -> Result<IRI, ParseError> {
- if parser.try(|i| i.expect_ident_matching("none")).is_ok() {
+ if parser.r#try(|i| i.expect_ident_matching("none")).is_ok() {
Ok(IRI::None)
} else {
let url = parser
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 887fbf25..73540406 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -1,11 +1,11 @@
use cssparser::{Parser, Token};
use std::f64::consts::*;
-use drawing_ctx::ViewParams;
-use error::*;
-use parsers::Parse;
-use parsers::ParseError;
-use properties::ComputedValues;
+use crate::drawing_ctx::ViewParams;
+use crate::error::*;
+use crate::parsers::Parse;
+use crate::parsers::ParseError;
+use crate::properties::ComputedValues;
pub type RsvgLength = Length;
@@ -360,7 +360,7 @@ impl Parse for Dasharray {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<Dasharray, ValueErrorKind> {
- if parser.try(|p| p.expect_ident_matching("none")).is_ok() {
+ if parser.r#try(|p| p.expect_ident_matching("none")).is_ok() {
Ok(Dasharray::None)
} else {
Ok(Dasharray::Array(parse_dash_array(parser)?))
@@ -377,7 +377,7 @@ fn parse_dash_array(parser: &mut Parser<'_, '_>) -> Result<Vec<LengthBoth>, Valu
if parser.is_exhausted() {
break;
- } else if parser.try(|p| p.expect_comma()).is_ok() {
+ } else if parser.r#try(|p| p.expect_comma()).is_ok() {
continue;
}
}
@@ -389,7 +389,7 @@ fn parse_dash_array(parser: &mut Parser<'_, '_>) -> Result<Vec<LengthBoth>, Valu
mod tests {
use super::*;
- use float_eq_cairo::ApproxEqCairo;
+ use crate::float_eq_cairo::ApproxEqCairo;
#[test]
fn parses_default() {
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index 6dafbdb2..0d9f2a30 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -1,33 +1,8 @@
-#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
-#![cfg_attr(feature = "cargo-clippy", allow(not_unsafe_ptr_arg_deref))]
-#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
+#![allow(clippy::clone_on_ref_ptr)]
+#![allow(clippy::not_unsafe_ptr_arg_deref)]
+#![allow(clippy::too_many_arguments)]
#![warn(unused)]
-extern crate cairo;
-extern crate cairo_sys;
-extern crate cssparser;
-extern crate data_url;
-extern crate downcast_rs;
-extern crate encoding;
-extern crate float_cmp;
-extern crate gdk_pixbuf;
-extern crate gdk_pixbuf_sys;
-extern crate gio;
-extern crate glib_sys;
-extern crate gobject_sys;
-extern crate itertools;
-extern crate language_tags;
-extern crate libc;
-extern crate locale_config;
-extern crate nalgebra;
-extern crate num_traits;
-extern crate owning_ref;
-extern crate pango;
-extern crate pango_sys;
-extern crate pangocairo;
-extern crate rayon;
-extern crate regex;
-extern crate url;
extern crate xml as xml_rs;
#[macro_use]
@@ -39,7 +14,7 @@ extern crate glib;
#[macro_use]
extern crate lazy_static;
-pub use c_api::{
+pub use crate::c_api::{
rsvg_rust_error_get_type,
rsvg_rust_handle_close,
rsvg_rust_handle_flags_get_type,
@@ -71,13 +46,13 @@ pub use c_api::{
rsvg_rust_handle_write,
};
-pub use color::{rsvg_css_parse_color, ColorKind, ColorSpec};
+pub use crate::color::{rsvg_css_parse_color, ColorKind, ColorSpec};
-pub use dpi::{rsvg_rust_set_default_dpi_x_y, Dpi};
+pub use crate::dpi::{rsvg_rust_set_default_dpi_x_y, Dpi};
-pub use drawing_ctx::RsvgRectangle;
+pub use crate::drawing_ctx::RsvgRectangle;
-pub use error::{
+pub use crate::error::{
rsvg_rust_error_quark,
DefsLookupErrorKind,
HrefError,
@@ -85,18 +60,18 @@ pub use error::{
RenderingError,
};
-pub use handle::{Handle, LoadFlags};
+pub use crate::handle::{Handle, LoadFlags};
-pub use length::{Length, LengthUnit};
+pub use crate::length::{Length, LengthUnit};
-pub use pixbuf_utils::{
+pub use crate::pixbuf_utils::{
rsvg_rust_pixbuf_from_file_at_max_size,
rsvg_rust_pixbuf_from_file_at_size,
rsvg_rust_pixbuf_from_file_at_zoom,
rsvg_rust_pixbuf_from_file_at_zoom_with_max,
};
-pub use rect::IRect;
+pub use crate::rect::IRect;
#[macro_use]
mod log;
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index 5ea779a5..4f72da05 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -2,11 +2,11 @@ use regex::{Captures, Regex};
use std::borrow::Cow;
use std::cell::RefCell;
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::RenderingError;
-use node::*;
-use property_bag::PropertyBag;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::RenderingError;
+use crate::node::*;
+use crate::property_bag::PropertyBag;
pub struct NodeLink {
link: RefCell<Option<String>>,
diff --git a/rsvg_internals/src/log.rs b/rsvg_internals/src/log.rs
index a90d0e22..32807a36 100644
--- a/rsvg_internals/src/log.rs
+++ b/rsvg_internals/src/log.rs
@@ -3,7 +3,7 @@ macro_rules! rsvg_log {
(
$($arg:tt)+
) => {
- if ::log::log_enabled() {
+ if crate::log::log_enabled() {
println!("{}", format_args!($($arg)+));
}
};
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index fa401e8a..5b54cb6d 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -5,22 +5,22 @@ use std::ops::Deref;
use cairo::{MatrixTrait, Rectangle};
use cssparser::{CowRcStr, Parser, Token};
-use allowed_url::Fragment;
-use angle::Angle;
-use aspect_ratio::*;
-use attributes::Attribute;
-use drawing_ctx::DrawingCtx;
-use error::*;
-use float_eq_cairo::ApproxEqCairo;
-use iri::IRI;
-use length::{LengthHorizontal, LengthVertical};
-use node::*;
-use parsers::{Parse, ParseError, ParseValue};
-use path_builder::*;
-use properties::{ComputedValues, SpecifiedValue, SpecifiedValues};
-use property_bag::PropertyBag;
-use rect::RectangleExt;
-use viewbox::*;
+use crate::allowed_url::Fragment;
+use crate::angle::Angle;
+use crate::aspect_ratio::*;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::*;
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::iri::IRI;
+use crate::length::{LengthHorizontal, LengthVertical};
+use crate::node::*;
+use crate::parsers::{Parse, ParseError, ParseValue};
+use crate::path_builder::*;
+use crate::properties::{ComputedValues, SpecifiedValue, SpecifiedValues};
+use crate::property_bag::PropertyBag;
+use crate::rect::RectangleExt;
+use crate::viewbox::*;
// markerUnits attribute: https://www.w3.org/TR/SVG/painting.html#MarkerElement
#[derive(Debug, Copy, Clone, PartialEq)]
@@ -77,7 +77,7 @@ impl Parse for MarkerOrient {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<MarkerOrient, ValueErrorKind> {
- if parser.try(|p| p.expect_ident_matching("auto")).is_ok() {
+ if parser.r#try(|p| p.expect_ident_matching("auto")).is_ok() {
Ok(MarkerOrient::Auto)
} else {
Angle::parse(parser).map(MarkerOrient::Angle)
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index 1d00e5b0..9048b786 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -1,23 +1,23 @@
use cairo::{self, MatrixTrait};
use std::cell::Cell;
-use attributes::Attribute;
-use coord_units::CoordUnits;
-use drawing_ctx::DrawingCtx;
-use error::RenderingError;
-use length::{LengthHorizontal, LengthVertical};
-use node::{NodeResult, NodeTrait, RsvgNode};
-use parsers::{Parse, ParseValue};
-use properties::Opacity;
-use property_bag::PropertyBag;
-use rect::IRect;
-use surface_utils::{
+use crate::attributes::Attribute;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::RenderingError;
+use crate::length::{LengthHorizontal, LengthVertical};
+use crate::node::{NodeResult, NodeTrait, RsvgNode};
+use crate::parsers::{Parse, ParseValue};
+use crate::properties::Opacity;
+use crate::property_bag::PropertyBag;
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::SharedImageSurface,
shared_surface::SurfaceType,
ImageSurfaceDataExt,
};
-use unit_interval::UnitInterval;
+use crate::unit_interval::UnitInterval;
coord_units!(MaskUnits, CoordUnits::ObjectBoundingBox);
coord_units!(MaskContentUnits, CoordUnits::UserSpaceOnUse);
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index 6188c59c..80ce82ad 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -4,16 +4,16 @@ use std::cell::{Cell, Ref, RefCell};
use std::collections::HashSet;
use std::rc::{Rc, Weak};
-use attributes::Attribute;
-use cond::{RequiredExtensions, RequiredFeatures, SystemLanguage};
-use css::CssStyles;
-use drawing_ctx::DrawingCtx;
-use error::*;
+use crate::attributes::Attribute;
+use crate::cond::{RequiredExtensions, RequiredFeatures, SystemLanguage};
+use crate::css::CssStyles;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::*;
+use crate::parsers::Parse;
+use crate::properties::{ComputedValues, Overflow, SpecifiedValue, SpecifiedValues};
+use crate::property_bag::PropertyBag;
+use crate::tree_utils;
use locale_config::Locale;
-use parsers::Parse;
-use properties::{ComputedValues, Overflow, SpecifiedValue, SpecifiedValues};
-use property_bag::PropertyBag;
-use tree_utils;
// A *const RsvgNode is just a pointer for the C code's benefit: it
// points to an Rc<Node>, which is our refcounted Rust representation
@@ -390,7 +390,7 @@ impl Node {
let mut cond = self.get_cond();
for (attr, value) in pbag.iter() {
- // FIXME: move this to "do catch" when we can bump the rustc version dependency
+ // FIXME: move this to "try {}" when we can bump the rustc version dependency
let mut parse = || {
match attr {
Attribute::RequiredExtensions if cond => {
diff --git a/rsvg_internals/src/number_list.rs b/rsvg_internals/src/number_list.rs
index 56e3f36c..e8f9cec6 100644
--- a/rsvg_internals/src/number_list.rs
+++ b/rsvg_internals/src/number_list.rs
@@ -1,6 +1,6 @@
use cssparser::{Parser, ParserInput};
-use parsers::{CssParserExt, ParseError};
+use crate::parsers::{CssParserExt, ParseError};
#[derive(Eq, PartialEq)]
pub enum NumberListLength {
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 1897e55d..1060cdf6 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -1,13 +1,13 @@
use cssparser::{self, Parser};
-use allowed_url::Fragment;
-use bbox::BoundingBox;
-use drawing_ctx::DrawingCtx;
-use error::*;
-use node::RsvgNode;
-use parsers::Parse;
-use properties::ComputedValues;
-use unit_interval::UnitInterval;
+use crate::allowed_url::Fragment;
+use crate::bbox::BoundingBox;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::*;
+use crate::node::RsvgNode;
+use crate::parsers::Parse;
+use crate::properties::ComputedValues;
+use crate::unit_interval::UnitInterval;
#[derive(Debug, Clone, PartialEq)]
pub enum PaintServer {
@@ -23,14 +23,14 @@ impl Parse for PaintServer {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<PaintServer, ValueErrorKind> {
- if parser.try(|i| i.expect_ident_matching("none")).is_ok() {
+ if parser.r#try(|i| i.expect_ident_matching("none")).is_ok() {
Ok(PaintServer::None)
- } else if let Ok(url) = parser.try(|i| i.expect_url()) {
+ } else if let Ok(url) = parser.r#try(|i| i.expect_url()) {
let alternate = if !parser.is_exhausted() {
- if parser.try(|i| i.expect_ident_matching("none")).is_ok() {
+ if parser.r#try(|i| i.expect_ident_matching("none")).is_ok() {
None
} else {
- Some(parser.try(|i| cssparser::Color::parse(i))?)
+ Some(parser.r#try(|i| cssparser::Color::parse(i))?)
}
} else {
None
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index adc4d249..e245cec1 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -2,8 +2,8 @@ use cssparser::{BasicParseError, Parser, ParserInput, Token};
use std::str;
-use attributes::Attribute;
-use error::{NodeError, ValueErrorKind};
+use crate::attributes::Attribute;
+use crate::error::{NodeError, ValueErrorKind};
#[derive(Debug, Clone, PartialEq)]
pub struct ParseError {
@@ -53,7 +53,7 @@ impl<'i, 't> CssParserExt for Parser<'i, 't> {
}
fn optional_comma(&mut self) {
- let _ = self.try(|p| p.expect_comma());
+ let _ = self.r#try(|p| p.expect_comma());
}
}
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index 35a19c3d..077f3e8f 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -3,8 +3,8 @@ use cairo;
use std::f64;
use std::f64::consts::*;
-use float_eq_cairo::ApproxEqCairo;
-use util::clamp;
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::util::clamp;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct LargeArc(pub bool);
diff --git a/rsvg_internals/src/path_parser.rs b/rsvg_internals/src/path_parser.rs
index b5de38f5..bdf26961 100644
--- a/rsvg_internals/src/path_parser.rs
+++ b/rsvg_internals/src/path_parser.rs
@@ -1,4 +1,4 @@
-use path_builder::*;
+use crate::path_builder::*;
use std::error::Error;
use std::fmt::{self, Display, Formatter};
use std::iter::Enumerate;
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 6e0b51db..ebcdffec 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -4,23 +4,23 @@ use std::cell::RefCell;
use std::f64;
use std::rc::*;
-use allowed_url::Fragment;
-use aspect_ratio::*;
-use attributes::Attribute;
-use bbox::*;
-use coord_units::CoordUnits;
-use drawing_ctx::{DrawingCtx, NodeStack};
-use error::{AttributeResultExt, RenderingError};
-use float_eq_cairo::ApproxEqCairo;
-use length::*;
-use node::*;
-use paint_server::PaintSource;
-use parsers::ParseValue;
-use properties::ComputedValues;
-use property_bag::PropertyBag;
-use rect::RectangleExt;
-use unit_interval::UnitInterval;
-use viewbox::*;
+use crate::allowed_url::Fragment;
+use crate::aspect_ratio::*;
+use crate::attributes::Attribute;
+use crate::bbox::*;
+use crate::coord_units::CoordUnits;
+use crate::drawing_ctx::{DrawingCtx, NodeStack};
+use crate::error::{AttributeResultExt, RenderingError};
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::length::*;
+use crate::node::*;
+use crate::paint_server::PaintSource;
+use crate::parsers::ParseValue;
+use crate::properties::ComputedValues;
+use crate::property_bag::PropertyBag;
+use crate::rect::RectangleExt;
+use crate::unit_interval::UnitInterval;
+use crate::viewbox::*;
coord_units!(PatternUnits, CoordUnits::ObjectBoundingBox);
coord_units!(PatternContentUnits, CoordUnits::UserSpaceOnUse);
diff --git a/rsvg_internals/src/pixbuf_utils.rs b/rsvg_internals/src/pixbuf_utils.rs
index cd205645..b411c742 100644
--- a/rsvg_internals/src/pixbuf_utils.rs
+++ b/rsvg_internals/src/pixbuf_utils.rs
@@ -7,11 +7,11 @@ use glib::translate::*;
use glib_sys;
use libc;
-use c_api::{get_rust_handle, rsvg_rust_handle_new_from_gfile_sync, RsvgDimensionData};
-use error::{set_gerror, RenderingError};
-use handle::Handle;
-use rect::IRect;
-use surface_utils::{
+use crate::c_api::{get_rust_handle, rsvg_rust_handle_new_from_gfile_sync, RsvgDimensionData};
+use crate::error::{set_gerror, RenderingError};
+use crate::handle::Handle;
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::SharedImageSurface,
shared_surface::SurfaceType,
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 08b06548..8cec8479 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -2,16 +2,16 @@ use cssparser::{self, Parser, Token};
use std::collections::HashSet;
use std::str::FromStr;
-use attributes::Attribute;
-use error::*;
-use font_props::{FontSizeSpec, FontWeightSpec, LetterSpacingSpec, SingleFontFamily};
-use iri::IRI;
-use length::{Dasharray, LengthBoth, LengthUnit};
-use paint_server::PaintServer;
-use parsers::{Parse, ParseError};
-use property_bag::PropertyBag;
-use property_macros::Property;
-use unit_interval::UnitInterval;
+use crate::attributes::Attribute;
+use crate::error::*;
+use crate::font_props::{FontSizeSpec, FontWeightSpec, LetterSpacingSpec, SingleFontFamily};
+use crate::iri::IRI;
+use crate::length::{Dasharray, LengthBoth, LengthUnit};
+use crate::paint_server::PaintServer;
+use crate::parsers::{Parse, ParseError};
+use crate::property_bag::PropertyBag;
+use crate::property_macros::Property;
+use crate::unit_interval::UnitInterval;
/// Representation of a single CSS property value.
///
@@ -264,7 +264,7 @@ impl SpecifiedValues {
value: &str,
accept_shorthands: bool,
) -> Result<(), NodeError> {
- // FIXME: move this to "do catch" when we can bump the rustc version dependency
+ // FIXME: move this to "try {}" when we can bump the rustc version dependency
let mut parse = || -> Result<(), ValueErrorKind> {
// please keep these sorted
match attr {
@@ -619,12 +619,12 @@ make_property!(
// These values come from Inkscape's SP_CSS_BASELINE_SHIFT_(SUB/SUPER/BASELINE);
// see sp_style_merge_baseline_shift_from_parent()
- fn parse(parser: &mut Parser<'_, '_>) -> Result<BaselineShift, ::error::ValueErrorKind> {
+ fn parse(parser: &mut Parser<'_, '_>) -> Result<BaselineShift, crate::error::ValueErrorKind> {
let parser_state = parser.state();
{
- let token = parser.next().map_err(|_| ::error::ValueErrorKind::Parse(
- ::parsers::ParseError::new("expected token"),
+ let token = parser.next().map_err(|_| crate::error::ValueErrorKind::Parse(
+ crate::parsers::ParseError::new("expected token"),
))?;
if let Token::Ident(ref cow) = token {
@@ -1127,13 +1127,13 @@ make_property!(
let mut underline = false;
let mut strike = false;
- if parser.try(|p| p.expect_ident_matching("none")).is_ok() {
+ if parser.r#try(|p| p.expect_ident_matching("none")).is_ok() {
return Ok(TextDecoration::default());
}
while !parser.is_exhausted() {
- let cow = parser.expect_ident().map_err(|_| ::error::ValueErrorKind::Parse(
- ::parsers::ParseError::new("expected identifier"),
+ let cow = parser.expect_ident().map_err(|_| crate::error::ValueErrorKind::Parse(
+ crate::parsers::ParseError::new("expected identifier"),
))?;
match cow.as_ref() {
diff --git a/rsvg_internals/src/property_bag.rs b/rsvg_internals/src/property_bag.rs
index f9646c17..1f932558 100644
--- a/rsvg_internals/src/property_bag.rs
+++ b/rsvg_internals/src/property_bag.rs
@@ -5,7 +5,7 @@ use std::ops::Deref;
use std::slice;
use std::str::{self, FromStr};
-use attributes::Attribute;
+use crate::attributes::Attribute;
pub struct PropertyBag<'a>(Vec<(Attribute, &'a CStr)>);
diff --git a/rsvg_internals/src/property_macros.rs b/rsvg_internals/src/property_macros.rs
index 0bed5881..27def0c1 100644
--- a/rsvg_internals/src/property_macros.rs
+++ b/rsvg_internals/src/property_macros.rs
@@ -1,6 +1,6 @@
pub trait Property<T> {
fn inherits_automatically() -> bool;
- fn compute(&self, &T) -> Self;
+ fn compute(&self, _: &T) -> Self;
}
/// Generates a property definition that simply parses strings to enum variants
@@ -43,10 +43,10 @@ macro_rules! make_property {
impl_default!($name, $name::$default);
impl_property!($computed_values_type, $name, $inherits_automatically);
- impl ::parsers::Parse for $name {
- type Err = ::error::ValueErrorKind;
+ impl crate::parsers::Parse for $name {
+ type Err = crate::error::ValueErrorKind;
- fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name, ::error::ValueErrorKind> {
+ fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name,
crate::error::ValueErrorKind> {
let loc = parser.current_source_location();
parser
@@ -62,7 +62,7 @@ macro_rules! make_property {
),
})
.map_err(|_| {
- ::error::ValueErrorKind::Parse(::parsers::ParseError::new(
+ crate::error::ValueErrorKind::Parse(crate::parsers::ParseError::new(
"unexpected value",
))
})
@@ -81,7 +81,7 @@ macro_rules! make_property {
impl_default!($name, $name($default));
- impl ::property_macros::Property<$computed_values_type> for $name {
+ impl crate::property_macros::Property<$computed_values_type> for $name {
fn inherits_automatically() -> bool {
$inherits_automatically
}
@@ -91,11 +91,11 @@ macro_rules! make_property {
}
}
- impl ::parsers::Parse for $name {
- type Err = ::error::ValueErrorKind;
+ impl crate::parsers::Parse for $name {
+ type Err = crate::error::ValueErrorKind;
- fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name, ::error::ValueErrorKind> {
- Ok($name(<$type as ::parsers::Parse>::parse(parser)?))
+ fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name,
crate::error::ValueErrorKind> {
+ Ok($name(<$type as crate::parsers::Parse>::parse(parser)?))
}
}
};
@@ -113,11 +113,11 @@ macro_rules! make_property {
$prop
- impl ::parsers::Parse for $name {
- type Err = ::error::ValueErrorKind;
+ impl crate::parsers::Parse for $name {
+ type Err = crate::error::ValueErrorKind;
- fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name, ::error::ValueErrorKind> {
- Ok($name(<$type as ::parsers::Parse>::parse(parser)?))
+ fn parse(parser: &mut ::cssparser::Parser<'_, '_>) -> Result<$name,
crate::error::ValueErrorKind> {
+ Ok($name(<$type as crate::parsers::Parse>::parse(parser)?))
}
}
};
@@ -187,7 +187,7 @@ macro_rules! impl_default {
macro_rules! impl_property {
($computed_values_type:ty, $name:ident, $inherits_automatically:expr) => {
- impl ::property_macros::Property<$computed_values_type> for $name {
+ impl crate::property_macros::Property<$computed_values_type> for $name {
fn inherits_automatically() -> bool {
$inherits_automatically
}
@@ -203,8 +203,8 @@ macro_rules! impl_property {
mod tests {
use super::*;
+ use crate::parsers::Parse;
use cssparser::RGBA;
- use parsers::Parse;
#[test]
fn check_generated_property() {
diff --git a/rsvg_internals/src/rect.rs b/rsvg_internals/src/rect.rs
index c2035152..3564a634 100644
--- a/rsvg_internals/src/rect.rs
+++ b/rsvg_internals/src/rect.rs
@@ -1,7 +1,7 @@
use cairo;
use cairo::MatrixTrait;
-use float_eq_cairo::ApproxEqCairo;
+use crate::float_eq_cairo::ApproxEqCairo;
pub trait RectangleExt {
fn new(x: f64, y: f64, width: f64, height: f64) -> cairo::Rectangle;
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 98d7b1d6..5b323b03 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -3,18 +3,18 @@ use std::cell::Cell;
use std::cell::RefCell;
use std::ops::Deref;
-use attributes::Attribute;
+use crate::attributes::Attribute;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::*;
+use crate::length::*;
+use crate::marker;
+use crate::node::*;
+use crate::parsers::{CssParserExt, Parse, ParseValue};
+use crate::path_builder::*;
+use crate::path_parser;
+use crate::properties::ComputedValues;
+use crate::property_bag::PropertyBag;
use cssparser::{Parser, Token};
-use drawing_ctx::DrawingCtx;
-use error::*;
-use length::*;
-use marker;
-use node::*;
-use parsers::{CssParserExt, Parse, ParseValue};
-use path_builder::*;
-use path_parser;
-use properties::ComputedValues;
-use property_bag::PropertyBag;
fn render_path_builder(
builder: &PathBuilder,
diff --git a/rsvg_internals/src/srgb.rs b/rsvg_internals/src/srgb.rs
index 0b283162..406f485b 100644
--- a/rsvg_internals/src/srgb.rs
+++ b/rsvg_internals/src/srgb.rs
@@ -3,8 +3,8 @@
//! The constant values in this module are taken from http://www.color.org/chardata/rgb/srgb.xalter
use cairo;
-use rect::IRect;
-use surface_utils::{
+use crate::rect::IRect;
+use crate::surface_utils::{
iterators::Pixels,
shared_surface::{SharedImageSurface, SurfaceType},
ImageSurfaceDataExt,
diff --git a/rsvg_internals/src/stop.rs b/rsvg_internals/src/stop.rs
index 172f0f0b..f125d5dc 100644
--- a/rsvg_internals/src/stop.rs
+++ b/rsvg_internals/src/stop.rs
@@ -1,12 +1,12 @@
use std::cell::Cell;
-use attributes::Attribute;
-use error::*;
-use length::*;
-use node::*;
-use parsers::ParseValue;
-use property_bag::PropertyBag;
-use unit_interval::UnitInterval;
+use crate::attributes::Attribute;
+use crate::error::*;
+use crate::length::*;
+use crate::node::*;
+use crate::parsers::ParseValue;
+use crate::property_bag::PropertyBag;
+use crate::unit_interval::UnitInterval;
pub struct NodeStop {
offset: Cell<UnitInterval>,
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 75abd1be..91a49029 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -3,21 +3,21 @@ use std::cell::RefCell;
use cairo::Rectangle;
-use allowed_url::Fragment;
-use aspect_ratio::*;
-use attributes::Attribute;
-use css::CssStyles;
-use dpi::Dpi;
-use drawing_ctx::{ClipMode, DrawingCtx, ViewParams};
-use error::{AttributeResultExt, RenderingError};
-use float_eq_cairo::ApproxEqCairo;
-use length::*;
-use node::*;
-use parsers::{Parse, ParseValue};
-use properties::{ComputedValues, Overflow};
-use property_bag::{OwnedPropertyBag, PropertyBag};
-use rect::RectangleExt;
-use viewbox::*;
+use crate::allowed_url::Fragment;
+use crate::aspect_ratio::*;
+use crate::attributes::Attribute;
+use crate::css::CssStyles;
+use crate::dpi::Dpi;
+use crate::drawing_ctx::{ClipMode, DrawingCtx, ViewParams};
+use crate::error::{AttributeResultExt, RenderingError};
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::length::*;
+use crate::node::*;
+use crate::parsers::{Parse, ParseValue};
+use crate::properties::{ComputedValues, Overflow};
+use crate::property_bag::{OwnedPropertyBag, PropertyBag};
+use crate::rect::RectangleExt;
+use crate::viewbox::*;
pub struct NodeGroup();
diff --git a/rsvg_internals/src/style.rs b/rsvg_internals/src/style.rs
index e201e9d6..cab5395a 100644
--- a/rsvg_internals/src/style.rs
+++ b/rsvg_internals/src/style.rs
@@ -1,7 +1,7 @@
-use attributes::Attribute;
-use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
-use property_bag::PropertyBag;
-use text::NodeChars;
+use crate::attributes::Attribute;
+use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::property_bag::PropertyBag;
+use crate::text::NodeChars;
use std::cell::RefCell;
diff --git a/rsvg_internals/src/surface_utils/iterators.rs b/rsvg_internals/src/surface_utils/iterators.rs
index 15c4b710..29ec0e51 100644
--- a/rsvg_internals/src/surface_utils/iterators.rs
+++ b/rsvg_internals/src/surface_utils/iterators.rs
@@ -1,6 +1,6 @@
//! Pixel iterators for `SharedImageSurface`.
-use rect::IRect;
-use util::clamp;
+use crate::rect::IRect;
+use crate::util::clamp;
use super::shared_surface::SharedImageSurface;
use super::{EdgeMode, Pixel};
@@ -185,8 +185,8 @@ impl<'a> Iterator for PixelRectangle<'a> {
#[cfg(test)]
mod tests {
use super::*;
+ use crate::surface_utils::shared_surface::SurfaceType;
use cairo::{self, ImageSurface};
- use surface_utils::shared_surface::SurfaceType;
#[test]
fn pixels_count() {
diff --git a/rsvg_internals/src/surface_utils/shared_surface.rs
b/rsvg_internals/src/surface_utils/shared_surface.rs
index 96c6bf2f..1a236973 100644
--- a/rsvg_internals/src/surface_utils/shared_surface.rs
+++ b/rsvg_internals/src/surface_utils/shared_surface.rs
@@ -11,9 +11,9 @@ use glib::translate::{Stash, ToGlibPtr};
use nalgebra::{storage::Storage, Dim, Matrix};
use rayon;
-use rect::IRect;
-use srgb;
-use util::clamp;
+use crate::rect::IRect;
+use crate::srgb;
+use crate::util::clamp;
use super::{
iterators::{PixelRectangle, Pixels},
diff --git a/rsvg_internals/src/svg.rs b/rsvg_internals/src/svg.rs
index cd03fe44..e8cba642 100644
--- a/rsvg_internals/src/svg.rs
+++ b/rsvg_internals/src/svg.rs
@@ -5,16 +5,16 @@ use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::rc::Rc;
-use allowed_url::{AllowedUrl, Fragment};
-use error::LoadingError;
-use handle::LoadOptions;
-use io::{self, BinaryData};
-use node::{NodeType, RsvgNode};
-use properties::ComputedValues;
-use structure::{IntrinsicDimensions, NodeSvg};
-use surface_utils::shared_surface::SharedImageSurface;
-use xml::XmlState;
-use xml2_load::xml_state_load_from_possibly_compressed_stream;
+use crate::allowed_url::{AllowedUrl, Fragment};
+use crate::error::LoadingError;
+use crate::handle::LoadOptions;
+use crate::io::{self, BinaryData};
+use crate::node::{NodeType, RsvgNode};
+use crate::properties::ComputedValues;
+use crate::structure::{IntrinsicDimensions, NodeSvg};
+use crate::surface_utils::shared_surface::SharedImageSurface;
+use crate::xml::XmlState;
+use crate::xml2_load::xml_state_load_from_possibly_compressed_stream;
/// A loaded SVG file and its derived data
///
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 1d953b66..1396e8e2 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -4,17 +4,17 @@ use pango_sys;
use pangocairo;
use std::cell::{Cell, RefCell};
-use allowed_url::Fragment;
-use attributes::Attribute;
-use bbox::BoundingBox;
-use drawing_ctx::DrawingCtx;
-use error::{AttributeResultExt, RenderingError};
-use float_eq_cairo::ApproxEqCairo;
-use font_props::FontWeightSpec;
-use length::*;
-use node::{CascadedValues, NodeResult, NodeTrait, NodeType, RsvgNode};
-use parsers::ParseValue;
-use properties::{
+use crate::allowed_url::Fragment;
+use crate::attributes::Attribute;
+use crate::bbox::BoundingBox;
+use crate::drawing_ctx::DrawingCtx;
+use crate::error::{AttributeResultExt, RenderingError};
+use crate::float_eq_cairo::ApproxEqCairo;
+use crate::font_props::FontWeightSpec;
+use crate::length::*;
+use crate::node::{CascadedValues, NodeResult, NodeTrait, NodeType, RsvgNode};
+use crate::parsers::ParseValue;
+use crate::properties::{
ComputedValues,
Direction,
FontStretch,
@@ -27,8 +27,8 @@ use properties::{
XmlLang,
XmlSpace,
};
-use property_bag::PropertyBag;
-use space::{xml_space_normalize, NormalizeDefault, XmlSpaceNormalize};
+use crate::property_bag::PropertyBag;
+use crate::space::{xml_space_normalize, NormalizeDefault, XmlSpaceNormalize};
/// An absolutely-positioned array of `Span`s
///
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index 9488163f..c223f378 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -5,8 +5,8 @@ use std::f64::consts::*;
use cairo::MatrixTrait;
use cssparser::{ParseError as CssParseError, Parser, Token};
-use error::*;
-use parsers::{finite_f32, CssParserExt, Parse, ParseError};
+use crate::error::*;
+use crate::parsers::{finite_f32, CssParserExt, Parse, ParseError};
impl Parse for cairo::Matrix {
type Err = ValueErrorKind;
@@ -118,7 +118,7 @@ fn parse_translate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Va
let tx = p.expect_number()?;
let ty = p
- .try(|p| -> Result<f32, CssParseError<'_, ()>> {
+ .r#try(|p| -> Result<f32, CssParseError<'_, ()>> {
p.optional_comma();
Ok(p.expect_number()?)
})
@@ -142,7 +142,7 @@ fn parse_scale_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueE
let x = p.expect_number()?;
let y = p
- .try(|p| -> Result<f32, CssParseError<'_, ()>> {
+ .r#try(|p| -> Result<f32, CssParseError<'_, ()>> {
p.optional_comma();
Ok(p.expect_number()?)
})
@@ -166,7 +166,7 @@ fn parse_rotate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Value
let angle = p.expect_number()?;
let (tx, ty) = p
- .try(|p| -> Result<_, CssParseError<'_, ()>> {
+ .r#try(|p| -> Result<_, CssParseError<'_, ()>> {
p.optional_comma();
let tx = p.expect_number()?;
diff --git a/rsvg_internals/src/unit_interval.rs b/rsvg_internals/src/unit_interval.rs
index 2577583c..8befc2ee 100644
--- a/rsvg_internals/src/unit_interval.rs
+++ b/rsvg_internals/src/unit_interval.rs
@@ -1,8 +1,8 @@
use cssparser::Parser;
-use error::*;
-use parsers::{CssParserExt, Parse, ParseError};
-use util;
+use crate::error::*;
+use crate::parsers::{CssParserExt, Parse, ParseError};
+use crate::util;
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
pub struct UnitInterval(pub f64);
diff --git a/rsvg_internals/src/viewbox.rs b/rsvg_internals/src/viewbox.rs
index 618be2a9..f0072018 100644
--- a/rsvg_internals/src/viewbox.rs
+++ b/rsvg_internals/src/viewbox.rs
@@ -1,8 +1,8 @@
use cssparser::Parser;
-use error::*;
-use number_list::{NumberList, NumberListLength};
-use parsers::{Parse, ParseError};
+use crate::error::*;
+use crate::number_list::{NumberList, NumberListLength};
+use crate::parsers::{Parse, ParseError};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct ViewBox {
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index ab238758..55d46184 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -1,25 +1,25 @@
+use crate::xml_rs::{reader::XmlEvent, ParserConfig};
use encoding::label::encoding_from_whatwg_label;
use encoding::DecoderTrap;
use libc;
use std::collections::HashMap;
use std::rc::Rc;
use std::str;
-use xml_rs::{reader::XmlEvent, ParserConfig};
-
-use allowed_url::AllowedUrl;
-use attributes::Attribute;
-use create_node::create_node_and_register_id;
-use css::CssStyles;
-use error::LoadingError;
-use handle::LoadOptions;
-use io;
-use node::{node_new, Node, NodeType, RsvgNode};
-use property_bag::PropertyBag;
-use structure::NodeSvg;
-use style::NodeStyle;
-use svg::Svg;
-use text::NodeChars;
-use xml2_load::{xml_state_parse_from_stream, ParseFromStreamError};
+
+use crate::allowed_url::AllowedUrl;
+use crate::attributes::Attribute;
+use crate::create_node::create_node_and_register_id;
+use crate::css::CssStyles;
+use crate::error::LoadingError;
+use crate::handle::LoadOptions;
+use crate::io;
+use crate::node::{node_new, Node, NodeType, RsvgNode};
+use crate::property_bag::PropertyBag;
+use crate::structure::NodeSvg;
+use crate::style::NodeStyle;
+use crate::svg::Svg;
+use crate::text::NodeChars;
+use crate::xml2_load::{xml_state_parse_from_stream, ParseFromStreamError};
#[derive(Clone)]
enum Context {
diff --git a/rsvg_internals/src/xml2_load.rs b/rsvg_internals/src/xml2_load.rs
index 951d8353..4e388405 100644
--- a/rsvg_internals/src/xml2_load.rs
+++ b/rsvg_internals/src/xml2_load.rs
@@ -13,14 +13,14 @@ use std::str;
use glib::translate::*;
-use error::LoadingError;
-use handle::LoadFlags;
-use io::get_input_stream_for_loading;
-use property_bag::PropertyBag;
-use util::cstr;
-use util::utf8_cstr;
-use xml::XmlState;
-use xml2::*;
+use crate::error::LoadingError;
+use crate::handle::LoadFlags;
+use crate::io::get_input_stream_for_loading;
+use crate::property_bag::PropertyBag;
+use crate::util::cstr;
+use crate::util::utf8_cstr;
+use crate::xml::XmlState;
+use crate::xml2::*;
fn get_xml2_sax_handler() -> xmlSAXHandler {
let mut h: xmlSAXHandler = unsafe { mem::zeroed() };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]