From dbfb3d2ced91e56314dfabbb4df9a338926c0a7a Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 3 Aug 2020 16:01:23 +0200 Subject: =?UTF-8?q?Formatting,=20documentation=20and=20small=20improvement?= =?UTF-8?q?s=20=F0=9F=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/style.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/style.rs') diff --git a/src/style.rs b/src/style.rs index 9dce381e..80389919 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,7 +1,10 @@ //! Styles for text and pages. -use fontdock::{fallback, FallbackTree, FontVariant, FontStyle, FontWeight, FontWidth}; -use crate::geom::{Size, Margins, Value4}; +use fontdock::{ + fallback, FallbackTree, FontStyle, FontVariant, FontWeight, FontWidth, +}; + +use crate::geom::{Margins, Size, Value4}; use crate::length::{Length, ScaleLength}; use crate::paper::{Paper, PaperClass, PAPER_A4}; @@ -62,8 +65,8 @@ impl TextStyle { } impl Default for TextStyle { - fn default() -> TextStyle { - TextStyle { + fn default() -> Self { + Self { fallback: fallback! { list: ["sans-serif"], classes: { @@ -105,8 +108,8 @@ pub struct PageStyle { impl PageStyle { /// The default page style for the given paper. - pub fn new(paper: Paper) -> PageStyle { - PageStyle { + pub fn new(paper: Paper) -> Self { + Self { class: paper.class, size: paper.size(), margins: Value4::with_all(None), @@ -127,7 +130,7 @@ impl PageStyle { } impl Default for PageStyle { - fn default() -> PageStyle { - PageStyle::new(PAPER_A4) + fn default() -> Self { + Self::new(PAPER_A4) } } -- cgit v1.2.3