Use LocalName and local_name! for attributes and properties

parent 5d6cd003
Version 2.45.7
- The poly element no longer supports "verts" as an alias for the
"points" attribute. The "verts" name was only used in SVG pre-1.0,
and we had been cargo-culting that name ever since.
Version 2.45.6
- Librsvg now requires Rust 1.30.0 or later.
......
......@@ -100,7 +100,13 @@ use gio::{Cancellable, FileExt};
use rsvg_internals::{Dpi, Handle};
pub use rsvg_internals::{
DefsLookupErrorKind, HrefError, Length, LengthUnit, LoadOptions, LoadingError, RenderingError,
DefsLookupErrorKind,
HrefError,
Length,
LengthUnit,
LoadOptions,
LoadingError,
RenderingError,
};
/// Struct for loading an [`SvgHandle`][SvgHandle].
......
......@@ -4,7 +4,7 @@ mod utils;
use rsvg_internals::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use self::utils::{load_svg, render_to_viewport, compare_to_surface, SurfaceSize};
use self::utils::{compare_to_surface, load_svg, render_to_viewport, SurfaceSize};
#[test]
fn simple_opacity_with_transform() {
......@@ -44,7 +44,11 @@ fn simple_opacity_with_transform() {
let reference_surf = SharedImageSurface::new(reference_surf, SurfaceType::SRgb).unwrap();
compare_to_surface(&output_surf, &reference_surf, "simple_opacity_with_transform");
compare_to_surface(
&output_surf,
&reference_surf,
"simple_opacity_with_transform",
);
}
#[test]
......@@ -85,7 +89,11 @@ fn simple_opacity_with_offset_viewport() {
let reference_surf = SharedImageSurface::new(reference_surf, SurfaceType::SRgb).unwrap();
compare_to_surface(&output_surf, &reference_surf, "simple_opacity_with_offset_viewport");
compare_to_surface(
&output_surf,
&reference_surf,
"simple_opacity_with_offset_viewport",
);
}
#[test]
......@@ -126,7 +134,11 @@ fn opacity_inside_transformed_group() {
let reference_surf = SharedImageSurface::new(reference_surf, SurfaceType::SRgb).unwrap();
compare_to_surface(&output_surf, &reference_surf, "opacity_inside_transformed_group");
compare_to_surface(
&output_surf,
&reference_surf,
"opacity_inside_transformed_group",
);
}
#[test]
......
......@@ -87,11 +87,7 @@ fn render_to_offsetted_viewport() {
let reference_surf = SharedImageSurface::new(reference_surf, SurfaceType::SRgb).unwrap();
compare_to_surface(
&output_surf,
&reference_surf,
"render_to_offseted_viewport",
);
compare_to_surface(&output_surf, &reference_surf, "render_to_offseted_viewport");
}
#[test]
......
......@@ -22,9 +22,7 @@ pub fn load_svg(input: &'static [u8]) -> SvgHandle {
let bytes = glib::Bytes::from_static(input);
let stream = gio::MemoryInputStream::new_from_bytes(&bytes);
Loader::new()
.read_stream(&stream, None, None)
.unwrap()
Loader::new().read_stream(&stream, None, None).unwrap()
}
#[derive(Copy, Clone)]
......@@ -146,9 +144,7 @@ pub fn compare_to_surface(
if diff.num_pixels_changed != 0 && diff.max_diff > MAX_DIFF {
println!(
"{}: {} pixels changed with maximum difference of {}",
output_base_name,
diff.num_pixels_changed,
diff.max_diff,
output_base_name, diff.num_pixels_changed, diff.max_diff,
);
unreachable!("surfaces are too different");
}
......
......@@ -222,7 +222,9 @@ impl Parse for AspectRatio {
type Err = ValueErrorKind;
fn parse(parser: &mut Parser<'_, '_>) -> Result<AspectRatio, ValueErrorKind> {
let defer = parser.try_parse(|p| p.expect_ident_matching("defer")).is_ok();
let defer = parser
.try_parse(|p| p.expect_ident_matching("defer"))
.is_ok();
let align_xy = parser.try_parse(|p| {
p.expect_ident()
......
......@@ -589,8 +589,9 @@ impl CHandle {
LoadState::Start => self.read_stream(state, stream, cancellable),
LoadState::Loading { .. } | LoadState::ClosedOk { .. } | LoadState::ClosedError => {
panic!(
"handle must not be already loaded in order to call rsvg_handle_read_stream_sync()",
)
"handle must not be already loaded in order to call \
rsvg_handle_read_stream_sync()",
)
}
}
}
......@@ -630,8 +631,8 @@ impl CHandle {
LoadState::ClosedError => {
rsvg_g_warning(
"Handle could not read or parse the SVG; did you check for errors during \
the loading stage?",
"Handle could not read or parse the SVG; did you check for errors during the \
loading stage?",
);
Err(RenderingError::HandleIsNotLoaded)
}
......
......@@ -2,7 +2,6 @@ use std::cell::Cell;
use cairo::{self, MatrixTrait};
use crate::attributes::Attribute;
use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::drawing_ctx::DrawingCtx;
......@@ -73,7 +72,7 @@ impl NodeTrait for NodeClipPath {
fn set_atts(&self, _: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
Attribute::ClipPathUnits => self.units.set(attr.parse(value)?),
local_name!("clipPathUnits") => self.units.set(attr.parse(value)?),
_ => (),
}
}
......
use std::collections::HashMap;
use crate::attributes::Attribute;
use crate::clip_path::NodeClipPath;
use crate::filters::{
blend::Blend,
......@@ -277,8 +276,8 @@ pub fn create_node_and_register_id(
for (attr, value) in pbag.iter() {
match attr {
Attribute::Id => id = Some(value),
Attribute::Class => class = Some(value),
local_name!("id") => id = Some(value),
local_name!("class") => class = Some(value),
_ => (),
}
}
......
use cssparser::{
self, parse_important, AtRuleParser, CowRcStr, DeclarationParser, Parser, ParserInput,
self,
parse_important,
AtRuleParser,
CowRcStr,
DeclarationParser,
Parser,
ParserInput,
};
use std::collections::hash_map::{Entry, Iter as HashMapIter};
use std::collections::HashMap;
use std::ptr;
use std::str::{self, FromStr};
use std::str;
use libc;
use markup5ever::LocalName;
use url::Url;
use glib::translate::*;
use glib_sys::{gboolean, gpointer, GList};
use crate::allowed_url::AllowedUrl;
use crate::attributes::Attribute;
use crate::croco::*;
use crate::error::*;
use crate::io::{self, BinaryData};
......@@ -23,14 +29,14 @@ use crate::util::utf8_cstr;
/// A parsed CSS declaration (`name: value [!important]`)
pub struct Declaration {
pub attribute: Attribute,
pub attribute: LocalName,
pub property: ParsedProperty,
pub important: bool,
}
pub struct DeclarationList {
// Maps property_name -> Declaration
declarations: HashMap<Attribute, Declaration>,
declarations: HashMap<LocalName, Declaration>,
}
pub struct DeclParser;
......@@ -44,20 +50,17 @@ impl<'i> DeclarationParser<'i> for DeclParser {
name: CowRcStr<'i>,
input: &mut Parser<'i, 't>,
) -> Result<Declaration, cssparser::ParseError<'i, ValueErrorKind>> {
if let Ok(attribute) = Attribute::from_str(name.as_ref()) {
let property = parse_attribute_value_into_parsed_property(attribute, input, true)
.map_err(|e| input.new_custom_error(e))?;
let attribute = LocalName::from(name.as_ref());
let property = parse_attribute_value_into_parsed_property(&attribute, input, true)
.map_err(|e| input.new_custom_error(e))?;
let important = input.try_parse(parse_important).is_ok();
let important = input.try_parse(parse_important).is_ok();
Ok(Declaration {
attribute,
property,
important,
})
} else {
Err(input.new_custom_error(ValueErrorKind::UnknownProperty))
}
Ok(Declaration {
attribute,
property,
important,
})
}
}
......@@ -91,7 +94,7 @@ impl DeclarationList {
}
fn add_declaration(&mut self, declaration: Declaration) {
match self.declarations.entry(declaration.attribute) {
match self.declarations.entry(declaration.attribute.clone()) {
Entry::Occupied(mut e) => {
let decl = e.get_mut();
......@@ -111,7 +114,7 @@ impl DeclarationList {
}
}
pub struct DeclarationListIter<'a>(HashMapIter<'a, Attribute, Declaration>);
pub struct DeclarationListIter<'a>(HashMapIter<'a, LocalName, Declaration>);
impl<'a> Iterator for DeclarationListIter<'a> {
type Item = &'a Declaration;
......@@ -397,26 +400,25 @@ unsafe extern "C" fn css_property(
let important = from_glib(a_is_important);
if let Ok(attribute) = Attribute::from_str(prop_name) {
let mut input = ParserInput::new(&prop_value);
let mut parser = Parser::new(&mut input);
match parse_attribute_value_into_parsed_property(attribute, &mut parser, true) {
Ok(property) => {
let declaration = Declaration {
attribute,
property,
important,
};
handler_data
.css_rules
.add_declaration(Selector::new(&selector_name), declaration);
}
Err(_) => (), // invalid property name or invalid value; ignore
let attribute = LocalName::from(prop_name);
let mut input = ParserInput::new(&prop_value);
let mut parser = Parser::new(&mut input);
match parse_attribute_value_into_parsed_property(&attribute, &mut parser, true) {
Ok(property) => {
let declaration = Declaration {
attribute,
property,
important,
};
handler_data
.css_rules
.add_declaration(Selector::new(&selector_name), declaration);
}
Err(_) => (), // invalid property name or invalid value; ignore
}
// else unknown property name; ignore
}
}
......
......@@ -21,8 +21,12 @@ use crate::paint_server::{PaintServer, PaintSource};
use crate::pattern::NodePattern;
use crate::properties::ComputedValues;
use crate::property_defs::{
ClipRule, FillRule, ShapeRendering, StrokeDasharray,
StrokeLinecap, StrokeLinejoin,
ClipRule,
FillRule,
ShapeRendering,
StrokeDasharray,
StrokeLinecap,
StrokeLinejoin,
};
use crate::rect::RectangleExt;
use crate::surface_utils::shared_surface::SharedImageSurface;
......
......@@ -8,8 +8,8 @@ use glib::error::ErrorDomain;
use glib::translate::*;
use glib_sys;
use libc;
use markup5ever::LocalName;
use crate::attributes::Attribute;
use crate::parsers::ParseError;
/// A simple error which refers to an attribute's value
......@@ -28,26 +28,26 @@ pub enum ValueErrorKind {
/// A complete error for an attribute and its erroneous value
#[derive(Debug, Clone, PartialEq)]
pub struct NodeError {
attr: Attribute,
attr: LocalName,
err: ValueErrorKind,
}
impl NodeError {
pub fn parse_error(attr: Attribute, error: ParseError) -> NodeError {
pub fn parse_error(attr: LocalName, error: ParseError) -> NodeError {
NodeError {
attr,
err: ValueErrorKind::Parse(error),
}
}
pub fn value_error(attr: Attribute, description: &str) -> NodeError {
pub fn value_error(attr: LocalName, description: &str) -> NodeError {
NodeError {
attr,
err: ValueErrorKind::Value(description.to_string()),
}
}
pub fn attribute_error(attr: Attribute, error: ValueErrorKind) -> NodeError {
pub fn attribute_error(attr: LocalName, error: ValueErrorKind) -> NodeError {
NodeError { attr, err: error }
}
}
......@@ -124,12 +124,12 @@ impl From<cairo::Status> for RenderingError {
/// Helper for converting `Result<O, E>` into `Result<O, NodeError>`
///
/// A `NodeError` requires an `Attribute` to which the error refers,
/// plus the actual `ValueErrorKind` that describes the error. However,
/// parsing functions for attribute value types will want to return their
/// own kind of error, instead of `ValueErrorKind`. If that particular error
/// type has an `impl From<FooError> for ValueErrorKind`, then this
/// trait helps assign attribute values in `set_atts()` methods as follows:
/// A `NodeError` requires a `LocalName` that corresponds to the attribute to which the
/// error refers, plus the actual `ValueErrorKind` that describes the error. However,
/// parsing functions for attribute value types will want to return their own kind of
/// error, instead of `ValueErrorKind`. If that particular error type has an `impl
/// From<FooError> for ValueErrorKind`, then this trait helps assign attribute values in
/// `set_atts()` methods as follows:
///
/// ```ignore
/// use error::AttributeResultExt;
......@@ -138,17 +138,17 @@ impl From<cairo::Status> for RenderingError {
///
/// // It is assumed that there is an impl From<FooError> for ValueErrorKind
///
/// self.foo = parse_foo(value).attribute(Attribute::Foo)?;
/// self.foo = parse_foo(value).attribute(local_name!("foo"))?;
/// ```
///
/// The call to `.attribute(attr)` converts the `Result` from `parse_foo()` into a full
/// `NodeError` with the provided `attr`.
pub trait AttributeResultExt<O, E> {
fn attribute(self, attr: Attribute) -> Result<O, NodeError>;
fn attribute(self, attr: LocalName) -> Result<O, NodeError>;
}
impl<O, E: Into<ValueErrorKind>> AttributeResultExt<O, E> for Result<O, E> {
fn attribute(self, attr: Attribute) -> Result<O, NodeError> {
fn attribute(self, attr: LocalName) -> Result<O, NodeError> {
self.map_err(|e| e.into())
.map_err(|e| NodeError::attribute_error(attr, e))
}
......
use std::cell::{Cell, RefCell};
use cairo;
use markup5ever::LocalName;
use crate::attributes::Attribute;
use crate::drawing_ctx::DrawingCtx;
use crate::error::NodeError;
use crate::node::{NodeResult, NodeTrait, RsvgNode};
......@@ -49,10 +49,10 @@ impl NodeTrait for Blend {
for (attr, value) in pbag.iter() {
match attr {
Attribute::In2 => {
local_name!("in2") => {
self.in2.replace(Some(Input::parse(attr, value)?));
}
Attribute::Mode => self.mode.set(Mode::parse(attr, value)?),
local_name!("mode") => self.mode.set(Mode::parse(attr, value)?),
_ => (),
}
}
......@@ -126,7 +126,7 @@ impl Filter for Blend {
}
impl Mode {
fn parse(attr: Attribute, s: &str) -> Result<Self, NodeError> {
fn parse(attr: LocalName, s: &str) -> Result<Self, NodeError> {
match s {
"normal" => Ok(Mode::Normal),
"multiply" => Ok(Mode::Multiply),
......
use std::cell::RefCell;
use cairo::{self, ImageSurface};
use markup5ever::LocalName;
use nalgebra::{Matrix3, Matrix4x5, Matrix5, Vector5};
use crate::attributes::Attribute;
use crate::drawing_ctx::DrawingCtx;
use crate::error::NodeError;
use crate::node::{NodeResult, NodeTrait, RsvgNode};
......@@ -53,7 +53,7 @@ impl NodeTrait for ColorMatrix {
// First, determine the operation type.
let mut operation_type = OperationType::Matrix;
for (attr, value) in pbag.iter().filter(|(attr, _)| *attr == Attribute::Type) {
for (attr, value) in pbag.iter().filter(|(attr, _)| *attr == local_name!("type")) {
operation_type = OperationType::parse(attr, value)?;
}
......@@ -71,7 +71,10 @@ impl NodeTrait for ColorMatrix {
),
);
} else {
for (attr, value) in pbag.iter().filter(|(attr, _)| *attr == Attribute::Values) {
for (attr, value) in pbag
.iter()
.filter(|(attr, _)| *attr == local_name!("values"))
{
let new_matrix = match operation_type {
OperationType::LuminanceToAlpha => unreachable!(),
OperationType::Matrix => {
......@@ -97,7 +100,7 @@ impl NodeTrait for ColorMatrix {
}
OperationType::Saturate => {
let s = parsers::number(value)
.map_err(|err| NodeError::attribute_error(attr, err))?;
.map_err(|err| NodeError::attribute_error(attr.clone(), err))?;
if s < 0.0 || s > 1.0 {
return Err(NodeError::value_error(attr, "expected value from 0 to 1"));
}
......@@ -229,7 +232,7 @@ impl Filter for ColorMatrix {
}
impl OperationType {
fn parse(attr: Attribute, s: &str) -> Result<Self, NodeError> {
fn parse(attr: LocalName, s: &str) -> Result<Self, NodeError> {
match s {
"matrix" => Ok(OperationType::Matrix),
"saturate" => Ok(OperationType::Saturate),
......
......@@ -2,8 +2,8 @@ use std::cell::{Cell, Ref, RefCell};
use std::cmp::min;
use cairo::{self, ImageSurface};
use markup5ever::LocalName;
use crate::attributes::Attribute;
use crate::drawing_ctx::DrawingCtx;
use crate::error::NodeError;
use crate::node::{NodeResult, NodeTrait, NodeType, RsvgNode};
......@@ -213,8 +213,8 @@ impl NodeTrait for FuncX {
fn set_atts(&self, _node: &RsvgNode, pbag: &PropertyBag<'_>) -> NodeResult {
for (attr, value) in pbag.iter() {
match attr {
Attribute::Type => self.function_type.set(FunctionType::parse(attr, value)?),
Attribute::TableValues => {
local_name!("type") => self.function_type.set(FunctionType::parse(attr, value)?),
local_name!("tableValues") => {
let NumberList(v) = NumberList::parse_str(value, NumberListLength::Unbounded)
.map_err(|err| {
if let NumberListError::Parse(err) = err {
......@@ -225,19 +225,19 @@ impl NodeTrait for FuncX {
})?;
self.table_values.replace(v);
}
Attribute::Slope => self.slope.set(
local_name!("slope") => self.slope.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::Intercept => self.intercept.set(
local_name!("intercept") => self.intercept.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::Amplitude => self.amplitude.set(
local_name!("amplitude") => self.amplitude.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::Exponent => self.exponent.set(
local_name!("exponent") => self.exponent.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::Offset => self.offset.set(
local_name!("offset") => self.offset.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
_ => (),
......@@ -384,7 +384,7 @@ impl Filter for ComponentTransfer {
}
impl FunctionType {
fn parse(attr: Attribute, s: &str) -> Result<Self, NodeError> {
fn parse(attr: LocalName, s: &str) -> Result<Self, NodeError> {
match s {
"identity" => Ok(FunctionType::Identity),
"table" => Ok(FunctionType::Table),
......
......@@ -3,7 +3,6 @@ use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface};
use cssparser::{CowRcStr, Parser, Token};
use crate::attributes::Attribute;
use crate::drawing_ctx::DrawingCtx;
use crate::error::{NodeError, ValueErrorKind};
use crate::node::{NodeResult, NodeTrait, RsvgNode};
......@@ -66,20 +65,20 @@ impl NodeTrait for Composite {
for (attr, value) in pbag.iter() {
match attr {
Attribute::In2 => {
self.in2.replace(Some(Input::parse(Attribute::In2, value)?));
local_name!("in2") => {
self.in2.replace(Some(Input::parse(attr, value)?));
}
Attribute::Operator => self.operator.set(attr.parse(value)?),
Attribute::K1 => self.k1.set(
local_name!("operator") => self.operator.set(attr.parse(value)?),
local_name!("k1") => self.k1.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::K2 => self.k2.set(
local_name!("k2") => self.k2.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::K3 => self.k3.set(
local_name!("k3") => self.k3.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::K4 => self.k4.set(
local_name!("k4") => self.k4.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
_ => (),
......
use std::cell::{Cell, RefCell};
use cairo::{self, ImageSurface, MatrixTrait};
use markup5ever::LocalName;
use nalgebra::{DMatrix, Dynamic, VecStorage};
use crate::attributes::Attribute;
use crate::drawing_ctx::DrawingCtx;
use crate::error::NodeError;
use crate::node::{NodeResult, NodeTrait, RsvgNode};
......@@ -62,9 +62,9 @@ impl NodeTrait for ConvolveMatrix {
for (attr, value) in pbag.iter() {
match attr {
Attribute::Order => self.order.set(
local_name!("order") => self.order.set(
parsers::integer_optional_integer(value)
.map_err(|err| NodeError::attribute_error(attr, err))
.map_err(|err| NodeError::attribute_error(attr.clone(), err))
.and_then(|(x, y)| {
if x > 0 && y > 0 {
Ok((x as u32, y as u32))
......@@ -76,9 +76,9 @@ impl NodeTrait for ConvolveMatrix {
}
})?,
),
Attribute::Divisor => self.divisor.set(Some(
local_name!("divisor") => self.divisor.set(Some(
parsers::number(value)
.map_err(|err| NodeError::attribute_error(attr, err))
.map_err(|err| NodeError::attribute_error(attr.clone(), err))
.and_then(|x| {
if x != 0.0 {
Ok(x)
......@@ -87,13 +87,13 @@ impl NodeTrait for ConvolveMatrix {
}
})?,
)),
Attribute::Bias => self.bias.set(
local_name!("bias") => self.bias.set(
parsers::number(value).map_err(|err| NodeError::attribute_error(attr, err))?,
),
Attribute::EdgeMode => self.edge_mode.set(EdgeMode::parse(attr, value)?),
Attribute::KernelUnitLength => self.kernel_unit_length.set(Some(
local_name!("edgeMode") => self.edge_mode.set(EdgeMode::parse(attr, value)?),
local_name!("kernelUnitLength") => self.kernel_unit_length.set(Some(
parsers::number_optional_number(value)
.map_err(|err| NodeError::attribute_error(attr, err))
.map_err(|err| NodeError::attribute_error(attr.clone(), err))
.and_then(|(x, y)| {
if x > 0.0 && y > 0.0 {
Ok((x, y))
......@@ -105,7 +105,7 @@ impl NodeTrait for ConvolveMatrix {
}
})?,
)),
Attribute::PreserveAlpha => self.preserve_alpha.set(match value {
local_name!("preserveAlpha") => self.preserve_alpha.set(match value {
"false" => false,
"true" => true,
_ => {
......@@ -122,9 +122,9 @@ impl NodeTrait for ConvolveMatrix {
// target_x and target_y depend on order.
for (attr, value) in pbag.iter() {
match attr {
Attribute::TargetX => self.target_x.set(Some(
local_name!("targetX") => self.target_x.set(Some(
parsers::integer(value)
.map_err(|err| NodeError::attribute_error(attr, err))
.map_err(|err| NodeError::attribute_error(attr.clone(), err))
.and_then(|x| {
if x >= 0 && x < self.order.get().0 as i32 {
Ok(x as u32)
......@@ -136,9 +136,9 @@ impl NodeTrait for ConvolveMatrix {
}
})?,
)),
Attribute::TargetY => self.target_y.set(Some(
local_name!("targetY") => self.target_y.set(Some(
parsers::integer(value)
.map_err(|err| NodeError::attribute_error(attr, err))
.map_err(|err| NodeError::attribute_error(attr.clone(), err))
.and_then(|x| {
if x >= 0 && x < self.order.get().1 as i32 {
Ok(x as u32)
......@@ -165,7 +165,7 @@ impl NodeTrait for ConvolveMatrix {
// Finally, parse the kernel matrix.
for (attr, value) in pbag
.iter()
.filter(|(attr, _)| *attr == Attribute::KernelMatrix)
.filter(|(attr, _)| *attr == local_name!("kernelMatrix"))
{
self.kernel_matrix.replace(Some({
let number_of_elements = self.order.get().0 as usize * self.order.get().1 as usize;
......@@ -175,7 +175,7 @@ impl NodeTrait for ConvolveMatrix {
let NumberList(v) = NumberList::parse_str(value, NumberListLength::Unbounded)
.map_err(|err| {
NodeError::parse_error(
attr,
attr.clone(),
match err {
NumberListError::IncorrectNumberOfElements => unreachable!(),
NumberListError::Parse(err) => err,
......@@ -185,7 +185,7 @@ impl NodeTrait for ConvolveMatrix {
if v.len() != number_of_elements {
return Err(NodeError::value_error(
attr,
attr.clone(),
&format!(
"incorrect number of elements: expected {}",
number_of_elements
......@@ -204,7 +204,7 @@ impl NodeTrait for ConvolveMatrix {
// kernel_matrix must have been specified.
if self.kernel_matrix.borrow().is_none() {
return Err(NodeError::value_error(
Attribute::KernelMatrix,
local_name!("kernelMatrix"),
"the value must be set",