|
17 | 17 | //! ```no_run |
18 | 18 | //! use eg_font_converter::{FontConverter, Mapping}; |
19 | 19 | //! |
20 | | -//! fn main() { |
21 | | -//! let out_dir = std::env::var_os("OUT_DIR").unwrap(); |
| 20 | +//! let out_dir = std::env::var_os("OUT_DIR").unwrap(); |
22 | 21 | //! |
23 | | -//! let font_6x10 = FontConverter::new("examples/6x10.bdf", "FONT_6X10_AZ") |
24 | | -//! .glyphs('A'..='Z') |
25 | | -//! .convert_mono_font() |
26 | | -//! .unwrap(); |
| 22 | +//! let font_6x10 = FontConverter::new("examples/6x10.bdf", "FONT_6X10_AZ") |
| 23 | +//! .glyphs('A'..='Z') |
| 24 | +//! .convert_mono_font() |
| 25 | +//! .unwrap(); |
27 | 26 | //! |
28 | | -//! font_6x10.save(&out_dir).unwrap(); |
29 | | -//! } |
| 27 | +//! font_6x10.save(&out_dir).unwrap(); |
30 | 28 | //! ``` |
31 | 29 | //! |
32 | 30 | //! And then use the [`include!`] macro to import the generated code into your project: |
@@ -264,12 +262,13 @@ impl<'a> FontConverter<'a> { |
264 | 262 | let bdf = match &self.bdf { |
265 | 263 | FileOrData::File(file) => { |
266 | 264 | let data = std::fs::read(file) |
267 | | - .with_context(|| format!("couldn't read BDF file from {:?}", file))?; |
| 265 | + .with_context(|| format!("couldn't read BDF file from {file:?}"))?; |
268 | 266 |
|
269 | | - ParserBdfFont::parse(&data).with_context(|| format!("couldn't parse BDF file"))? |
| 267 | + ParserBdfFont::parse(&data) |
| 268 | + .with_context(|| "couldn't parse BDF file".to_string())? |
270 | 269 | } |
271 | 270 | FileOrData::Data(data) => { |
272 | | - ParserBdfFont::parse(data).with_context(|| format!("couldn't parse BDF file"))? |
| 271 | + ParserBdfFont::parse(data).with_context(|| "couldn't parse BDF file".to_string())? |
273 | 272 | } |
274 | 273 | }; |
275 | 274 |
|
@@ -439,7 +438,7 @@ impl Font { |
439 | 438 | } |
440 | 439 |
|
441 | 440 | fn data_file_path(&self, output_directory: &Path) -> PathBuf { |
442 | | - output_directory.join(&self.data_file()) |
| 441 | + output_directory.join(self.data_file()) |
443 | 442 | } |
444 | 443 | } |
445 | 444 |
|
@@ -518,8 +517,10 @@ pub enum Visibility { |
518 | 517 | PubIn(String), |
519 | 518 | } |
520 | 519 |
|
521 | | -impl ToString for Visibility { |
522 | | - fn to_string(&self) -> String { |
| 520 | +impl Visibility { |
| 521 | + // TODO: is Visibility even used anymore? |
| 522 | + #[allow(unused)] |
| 523 | + fn to_rust(&self) -> String { |
523 | 524 | match self { |
524 | 525 | Visibility::Private => "", |
525 | 526 | Visibility::Pub => "pub", |
|
0 commit comments