diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2020-01-02 16:41:47 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2020-01-02 19:22:03 +0100 |
commit | fdcc7653f2783ad6702d1dc4dabca24e1811b1cf (patch) | |
tree | 8be99a41a05a80884d79fbc20af85c35560e039e /components/script/dom/webgl_validations/tex_image_2d.rs | |
parent | 728133611656f37480b96103dcc1d025f7d12ba3 (diff) | |
download | servo-fdcc7653f2783ad6702d1dc4dabca24e1811b1cf.tar.gz servo-fdcc7653f2783ad6702d1dc4dabca24e1811b1cf.zip |
Fix some warnings in future Rust nightlies
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) } } |