plotters-rs / plotters-canvas

Plotters HTML5 Canvas-WASM Backend
MIT License
33 stars 20 forks source link

non-exhaustive patterns: `RotateAngle(_)` not covered #6

Closed facorread closed 2 years ago

facorread commented 2 years ago

Compilation fails against the git-master version of plotters-backend. plotters-rs/plotters-backend#2 introduced arbitrary angles for FontTransform, but plotters-cairo has not caught on because its CI is configured to build against the stable version of plotters-backend.

This issue was discovered while working on the plotters-rs/plotters#373 proposal.

plotters-cairo pr-ci-master* $ cd ../plotters-canvas && cargo build
   Compiling plotters-backend v0.3.1 (D:\plotters-backend)
   Compiling wasm-bindgen v0.2.81
   Compiling js-sys v0.3.58
   Compiling web-sys v0.3.58
   Compiling plotters-canvas v0.3.0 (D:\plotters-canvas)
error[E0004]: non-exhaustive patterns: `RotateAngle(_)` not covered
   --> src\canvas.rs:250:28
    |
250 |         let degree = match style.transform() {
    |                            ^^^^^^^^^^^^^^^^^ pattern `RotateAngle(_)` not covered
    |
note: `FontTransform` defined here
   --> D:\plotters-backend\src\text.rs:139:5
    |
129 | / pub enum FontTransform {
130 | |     /// Nothing to transform
131 | |     None,
132 | |     /// Rotating the text 90 degree clockwise
...   |
139 | |     RotateAngle(f32),
    | |     ^^^^^^^^^^^ not covered
140 | | }
    | |_-
    = note: the matched value is of type `FontTransform`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
254 ~             FontTransform::Rotate270 => 270.0,
255 ~             RotateAngle(_) => todo!(),
    |

For more information about this error, try `rustc --explain E0004`.
error: could not compile `plotters-canvas` due to previous error
warning: build failed, waiting for other jobs to finish...