diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index eed28df0..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,17 +23,17 @@ 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 - needs: - - formatting - steps: - uses: actions/checkout@v2 @@ -47,11 +47,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 +78,6 @@ jobs: - name: nightly rust: nightly - - name: msrv - rust: 1.61.0 - steps: - uses: actions/checkout@v2 @@ -132,7 +142,7 @@ jobs: toolchain: stable target: thumbv7em-none-eabihf override: true - + - name: Check doc links run: | cargo doc --color=never &> ./out 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(), ) }