plotters-rs/plotters

[BUG] InvalidFont not implements Debug, so Result<(), InvalidFont> cannot be unwrapped

qarmin opened this issue · 0 comments

qarmin commented

To Reproduce

  • needs to enable in Cargo.toml featureab_glyph
use crate::pdf_creator::items::data::FONT_ROBOTO_REGULAR;
use plotters::style::register_font;
use plotters_backend::FontStyle;

pub fn register_pdf_fonts() {
    register_font("roboto-regular", FontStyle::Normal, FONT_ROBOTO_REGULAR).unwrap();
}

produce error:

error[E0277]: `style::font::ab_glyph::InvalidFont` doesn't implement `std::fmt::Debug`
    --> src/pdf_creator/init.rs:6:77
     |
6    |     register_font("roboto-regular", FontStyle::Normal, FONT_ROBOTO_REGULAR).unwrap();
     |                                                                             ^^^^^^ `style::font::ab_glyph::InvalidFont` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
     |
     = help: the trait `std::fmt::Debug` is not implemented for `style::font::ab_glyph::InvalidFont`
note: required by a bound in `Result::<T, E>::unwrap`
    --> /home/rafal/.rustup/toolchains/1.72.1-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1072:12
     |
1070 |     pub fn unwrap(self) -> T
     |            ------ required by a bound in this associated function
1071 |     where
1072 |         E: fmt::Debug,
     |            ^^^^^^^^^^ required by this bound in `Result::<T, E>::unwrap`

Version Information
0.3.5