diff options
Diffstat (limited to 'components/script/dom/webgl_validations/tex_image_2d.rs')
-rw-r--r-- | components/script/dom/webgl_validations/tex_image_2d.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs index fc5919132cf..54643e7a2da 100644 --- a/components/script/dom/webgl_validations/tex_image_2d.rs +++ b/components/script/dom/webgl_validations/tex_image_2d.rs @@ -47,10 +47,12 @@ pub enum TexImageValidationError { InvalidOffsets, } -impl std::error::Error for TexImageValidationError { - fn description(&self) -> &str { +impl std::error::Error for TexImageValidationError {} + +impl fmt::Display for TexImageValidationError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use self::TexImageValidationError::*; - match *self { + let description = match *self { InvalidTextureTarget(_) => "Invalid texture target", TextureTargetNotBound(_) => "Texture was not bound", InvalidCubicTextureDimensions => { @@ -68,17 +70,8 @@ impl std::error::Error for TexImageValidationError { NonPotTexture => "Expected a power of two texture", InvalidCompressionFormat => "Unrecognized texture compression format", InvalidOffsets => "Invalid X/Y texture offset parameters", - } - } -} - -impl fmt::Display for TexImageValidationError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "TexImageValidationError({})", - std::error::Error::description(self) - ) + }; + write!(f, "TexImageValidationError({})", description) } } |