From dfc22b00080f87471974e873d9ff8bec384d3b68 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 15:45:27 +0100 Subject: [PATCH] Reformat with the 2024 rustfmt style edition --- rustfmt.toml | 1 - showbits-common/src/tree.rs | 2 +- showbits-common/src/view.rs | 4 ++-- showbits-common/src/widgets/block.rs | 2 +- showbits-common/src/widgets/image.rs | 2 +- showbits-common/src/widgets/text.rs | 4 ++-- showbits-common/src/widgets/typst.rs | 4 ++-- showbits-thermal-printer/src/drawer/calendar.rs | 4 ++-- showbits-thermal-printer/src/drawer/cells.rs | 6 +++--- showbits-thermal-printer/src/drawer/chat_message.rs | 4 ++-- showbits-thermal-printer/src/drawer/egg.rs | 8 ++++---- showbits-thermal-printer/src/drawer/image.rs | 4 ++-- showbits-thermal-printer/src/drawer/photo.rs | 4 ++-- showbits-thermal-printer/src/drawer/text.rs | 2 +- showbits-thermal-printer/src/drawer/tictactoe.rs | 4 ++-- showbits-thermal-printer/src/drawer/typst.rs | 2 +- showbits-thermal-printer/src/printer.rs | 4 ++-- showbits-thermal-printer/src/server.rs | 2 +- showbits-thermal-printer/src/server/static.rs | 2 +- 19 files changed, 32 insertions(+), 33 deletions(-) delete mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 8153a3d..0000000 --- a/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -style_edition = "2021" diff --git a/showbits-common/src/tree.rs b/showbits-common/src/tree.rs index 6a5d9a3..8b0d14d 100644 --- a/showbits-common/src/tree.rs +++ b/showbits-common/src/tree.rs @@ -2,7 +2,7 @@ use image::RgbaImage; use palette::Srgba; use taffy::{AvailableSpace, NodeId, Point, Size, TaffyResult, TaffyTree}; -use crate::{color, BoxedWidget, Rect, Vec2, View}; +use crate::{BoxedWidget, Rect, Vec2, View, color}; fn point_to_vec2(point: Point) -> Vec2 { Vec2::new(point.x as i32, point.y as i32) diff --git a/showbits-common/src/view.rs b/showbits-common/src/view.rs index 4623887..077d913 100644 --- a/showbits-common/src/view.rs +++ b/showbits-common/src/view.rs @@ -1,7 +1,7 @@ use image::RgbaImage; -use palette::{blend::Compose, Srgba}; +use palette::{Srgba, blend::Compose}; -use crate::{color, Rect, Vec2}; +use crate::{Rect, Vec2, color}; pub struct View<'a> { area: Rect, diff --git a/showbits-common/src/widgets/block.rs b/showbits-common/src/widgets/block.rs index 30f010c..25c0c34 100644 --- a/showbits-common/src/widgets/block.rs +++ b/showbits-common/src/widgets/block.rs @@ -1,7 +1,7 @@ use palette::Srgba; use taffy::Layout; -use crate::{color, Rect, Vec2, View, Widget}; +use crate::{Rect, Vec2, View, Widget, color}; pub struct Block { border: Srgba, diff --git a/showbits-common/src/widgets/image.rs b/showbits-common/src/widgets/image.rs index a3474ec..b347810 100644 --- a/showbits-common/src/widgets/image.rs +++ b/showbits-common/src/widgets/image.rs @@ -1,6 +1,6 @@ use image::{ - imageops::{self, FilterType}, RgbaImage, + imageops::{self, FilterType}, }; use mark::dither::{AlgoFloydSteinberg, AlgoStucki, Algorithm, DiffEuclid, Palette}; use palette::{IntoColor, LinSrgb, Srgba}; diff --git a/showbits-common/src/widgets/text.rs b/showbits-common/src/widgets/text.rs index 55f59a5..48e8ae1 100644 --- a/showbits-common/src/widgets/text.rs +++ b/showbits-common/src/widgets/text.rs @@ -2,11 +2,11 @@ use cosmic_text::{Attrs, AttrsOwned, Buffer, Family, FontSystem, Metrics, Shapin use palette::Srgba; use showbits_assets::{UNIFONT, UNIFONT_JP, UNIFONT_NAME, UNIFONT_SIZE, UNIFONT_UPPER}; use taffy::{ - prelude::{AvailableSpace, Size}, Layout, + prelude::{AvailableSpace, Size}, }; -use crate::{color, Rect, Vec2, View, Widget}; +use crate::{Rect, Vec2, View, Widget, color}; // https://github.com/DioxusLabs/taffy/blob/main/examples/cosmic_text.rs diff --git a/showbits-common/src/widgets/typst.rs b/showbits-common/src/widgets/typst.rs index 359b4a4..d49df92 100644 --- a/showbits-common/src/widgets/typst.rs +++ b/showbits-common/src/widgets/typst.rs @@ -4,10 +4,11 @@ use anyhow::anyhow; use comemo::Prehashed; use image::RgbaImage; use taffy::{ - prelude::{AvailableSpace, Size}, Layout, + prelude::{AvailableSpace, Size}, }; use typst::{ + Library, World, diag::{FileError, FileResult}, eval::Tracer, foundations::{Bytes, Datetime}, @@ -15,7 +16,6 @@ use typst::{ syntax::{FileId, Source}, text::{Font, FontBook}, visualize::Color, - Library, World, }; use crate::{View, Widget}; diff --git a/showbits-thermal-printer/src/drawer/calendar.rs b/showbits-thermal-printer/src/drawer/calendar.rs index 1dbbd0e..8df39fb 100644 --- a/showbits-thermal-printer/src/drawer/calendar.rs +++ b/showbits-thermal-printer/src/drawer/calendar.rs @@ -1,11 +1,11 @@ use showbits_common::{ + Node, Tree, WidgetExt, color::{BLACK, WHITE}, widgets::{Block, Text}, - Node, Tree, WidgetExt, }; use taffy::{ - style_helpers::{length, percent, repeat}, AlignContent, AlignItems, Display, FlexDirection, + style_helpers::{length, percent, repeat}, }; use time::Date; diff --git a/showbits-thermal-printer/src/drawer/cells.rs b/showbits-thermal-printer/src/drawer/cells.rs index 886fea3..e5be0f0 100644 --- a/showbits-thermal-printer/src/drawer/cells.rs +++ b/showbits-thermal-printer/src/drawer/cells.rs @@ -1,9 +1,9 @@ use image::{ - imageops::{self, FilterType}, Rgba, RgbaImage, + imageops::{self, FilterType}, }; -use showbits_common::{color, widgets::Image, Node, Tree, WidgetExt}; -use taffy::{style_helpers::percent, AlignItems, Display, FlexDirection}; +use showbits_common::{Node, Tree, WidgetExt, color, widgets::Image}; +use taffy::{AlignItems, Display, FlexDirection, style_helpers::percent}; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/chat_message.rs b/showbits-thermal-printer/src/drawer/chat_message.rs index 2e1f129..b75718c 100644 --- a/showbits-thermal-printer/src/drawer/chat_message.rs +++ b/showbits-thermal-printer/src/drawer/chat_message.rs @@ -1,11 +1,11 @@ use showbits_common::{ + Node, Tree, WidgetExt, color::{BLACK, WHITE}, widgets::{Block, Text}, - Node, Tree, WidgetExt, }; use taffy::{ - style_helpers::{length, percent}, AlignItems, Display, FlexDirection, + style_helpers::{length, percent}, }; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/egg.rs b/showbits-thermal-printer/src/drawer/egg.rs index 1e7f060..f96fcd5 100644 --- a/showbits-thermal-printer/src/drawer/egg.rs +++ b/showbits-thermal-printer/src/drawer/egg.rs @@ -1,12 +1,12 @@ -use image::{imageops, RgbaImage}; -use rand::{seq::SliceRandom, Rng}; +use image::{RgbaImage, imageops}; +use rand::{Rng, seq::SliceRandom}; use showbits_assets::{EGG_BAD_COVERS, EGG_BAD_PATTERNS, EGG_COVERS, EGG_PATTERNS}; use showbits_common::{ + Node, Tree, WidgetExt, color::{self, WHITE}, widgets::{Image, Text}, - Node, Tree, WidgetExt, }; -use taffy::{style_helpers::percent, AlignItems, Display, FlexDirection}; +use taffy::{AlignItems, Display, FlexDirection, style_helpers::percent}; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/image.rs b/showbits-thermal-printer/src/drawer/image.rs index af84f71..13f1f0e 100644 --- a/showbits-thermal-printer/src/drawer/image.rs +++ b/showbits-thermal-printer/src/drawer/image.rs @@ -1,11 +1,11 @@ use image::RgbaImage; use palette::{FromColor, IntoColor, LinLumaa}; use showbits_common::{ + Node, Tree, WidgetExt, color::{self, BLACK, WHITE}, widgets::Image, - Node, Tree, WidgetExt, }; -use taffy::{style_helpers::percent, AlignItems, Display, FlexDirection}; +use taffy::{AlignItems, Display, FlexDirection, style_helpers::percent}; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/photo.rs b/showbits-thermal-printer/src/drawer/photo.rs index 52b1a1d..c58774b 100644 --- a/showbits-thermal-printer/src/drawer/photo.rs +++ b/showbits-thermal-printer/src/drawer/photo.rs @@ -1,12 +1,12 @@ use image::{Luma, Pixel, RgbaImage}; use showbits_common::{ + Node, Tree, WidgetExt, color::{BLACK, WHITE}, widgets::{Image, Text}, - Node, Tree, WidgetExt, }; use taffy::{ - style_helpers::{length, percent}, AlignItems, Display, FlexDirection, + style_helpers::{length, percent}, }; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/text.rs b/showbits-thermal-printer/src/drawer/text.rs index 21546bd..7617cbc 100644 --- a/showbits-thermal-printer/src/drawer/text.rs +++ b/showbits-thermal-printer/src/drawer/text.rs @@ -1,4 +1,4 @@ -use showbits_common::{color::WHITE, widgets::Text, Node, Tree, WidgetExt}; +use showbits_common::{Node, Tree, WidgetExt, color::WHITE, widgets::Text}; use taffy::style_helpers::percent; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/tictactoe.rs b/showbits-thermal-printer/src/drawer/tictactoe.rs index 62da12a..10d3bc8 100644 --- a/showbits-thermal-printer/src/drawer/tictactoe.rs +++ b/showbits-thermal-printer/src/drawer/tictactoe.rs @@ -1,11 +1,11 @@ use showbits_common::{ + Node, Tree, WidgetExt, color::{BLACK, WHITE}, widgets::{Block, Text}, - Node, Tree, WidgetExt, }; use taffy::{ - style_helpers::{length, percent, repeat}, AlignItems, Display, FlexDirection, + style_helpers::{length, percent, repeat}, }; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/drawer/typst.rs b/showbits-thermal-printer/src/drawer/typst.rs index 77b93da..be00db4 100644 --- a/showbits-thermal-printer/src/drawer/typst.rs +++ b/showbits-thermal-printer/src/drawer/typst.rs @@ -1,4 +1,4 @@ -use showbits_common::{color::WHITE, widgets::Typst, Node, Tree, WidgetExt}; +use showbits_common::{Node, Tree, WidgetExt, color::WHITE, widgets::Typst}; use taffy::style_helpers::percent; use crate::printer::Printer; diff --git a/showbits-thermal-printer/src/printer.rs b/showbits-thermal-printer/src/printer.rs index f625ef8..c10adcf 100644 --- a/showbits-thermal-printer/src/printer.rs +++ b/showbits-thermal-printer/src/printer.rs @@ -3,10 +3,10 @@ use std::path::PathBuf; use escpos::{ driver::FileDriver, printer::Printer as EPrinter, - utils::{PageCode, Protocol, GS}, + utils::{GS, PageCode, Protocol}, }; use image::{Rgba, RgbaImage}; -use showbits_common::{color, Tree}; +use showbits_common::{Tree, color}; use taffy::{AvailableSpace, NodeId, Size}; pub struct Printer { diff --git a/showbits-thermal-printer/src/server.rs b/showbits-thermal-printer/src/server.rs index ab95e20..7f61191 100644 --- a/showbits-thermal-printer/src/server.rs +++ b/showbits-thermal-printer/src/server.rs @@ -3,11 +3,11 @@ mod r#static; mod statuscode; use axum::{ + Form, Router, extract::{DefaultBodyLimit, Multipart, State}, http::StatusCode, response::{IntoResponse, Redirect, Response}, routing::{get, post}, - Form, Router, }; use serde::Deserialize; use tokio::{net::TcpListener, sync::mpsc}; diff --git a/showbits-thermal-printer/src/server/static.rs b/showbits-thermal-printer/src/server/static.rs index 6e7efac..449b62f 100644 --- a/showbits-thermal-printer/src/server/static.rs +++ b/showbits-thermal-printer/src/server/static.rs @@ -1,5 +1,5 @@ use axum::{ - http::{header, StatusCode, Uri}, + http::{StatusCode, Uri, header}, response::{IntoResponse, Response}, }; use rust_embed::RustEmbed;