From 7d8d520ebc0f8e46d3c79f5cb2a82bd0e0e24bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 10 Oct 2025 18:03:05 +0200 Subject: [PATCH 1/3] Build MSRV separately --- .github/workflows/rust.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index eed28df0..178fea35 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -31,9 +31,6 @@ jobs: build-nostd: runs-on: ubuntu-latest - needs: - - formatting - steps: - uses: actions/checkout@v2 @@ -47,11 +44,24 @@ jobs: - name: Build no_std run: cargo build --verbose --target thumbv7em-none-eabihf -Z avoid-dev-deps - build: + build-msrv: runs-on: ubuntu-latest - needs: - - formatting + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.61 + target: thumbv7em-none-eabihf + override: true + + - name: Build with MSRV + run: cargo build + + build: + runs-on: ubuntu-latest strategy: matrix: @@ -65,9 +75,6 @@ jobs: - name: nightly rust: nightly - - name: msrv - rust: 1.61.0 - steps: - uses: actions/checkout@v2 @@ -132,7 +139,7 @@ jobs: toolchain: stable target: thumbv7em-none-eabihf override: true - + - name: Check doc links run: | cargo doc --color=never &> ./out From 22ac8a2289722e94d80f04117d0380720c48725a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 10 Oct 2025 18:04:52 +0200 Subject: [PATCH 2/3] Run clippy as part of the lint check --- .github/workflows/rust.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 178fea35..62d126e4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,7 +11,7 @@ env: jobs: - formatting: + linting: runs-on: ubuntu-latest steps: @@ -23,11 +23,14 @@ jobs: toolchain: stable target: thumbv7em-none-eabihf override: true - components: rustfmt + components: rustfmt, clippy - name: Check formatting run: cargo fmt --all -- --check + - name: Run clippy + run: cargo clippy -- -D warnings + build-nostd: runs-on: ubuntu-latest From d68bb864210376854470c2260bbd07c7ba0a6205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 10 Oct 2025 18:05:12 +0200 Subject: [PATCH 3/3] Fix clippy lints --- CHANGELOG.md | 7 +++++++ src/style/builder.rs | 7 +++++++ src/utils.rs | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 831ca192..055ffe8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +Unreleased +========== + + - [#174] Implement `Default` for `TextBoxStyleBuilder` + +[#174]: https://github.com/embedded-graphics/embedded-text/pull/174 + 0.7.3 (2025-10-10) ================== diff --git a/src/style/builder.rs b/src/style/builder.rs index 2dfc51b1..2f1866eb 100644 --- a/src/style/builder.rs +++ b/src/style/builder.rs @@ -15,6 +15,13 @@ pub struct TextBoxStyleBuilder { trailing_spaces: Option, } +impl Default for TextBoxStyleBuilder { + #[inline] + fn default() -> Self { + Self::new() + } +} + impl TextBoxStyleBuilder { /// Create a new builder object. #[inline] diff --git a/src/utils.rs b/src/utils.rs index 9d5f8a50..1754cb97 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -22,7 +22,7 @@ pub fn str_width_and_left_offset(renderer: &impl TextRenderer, s: &str) -> (u32, let tm = renderer.measure_string(s, Point::zero(), Baseline::Top); ( tm.next_position.x as u32, - tm.bounding_box.top_left.x.min(0).abs() as u32, + tm.bounding_box.top_left.x.min(0).unsigned_abs(), ) }