Skip to content

Commit b5a4b60

Browse files
committed
Fix cargo doc warnings and add CI script
1 parent e7d47d9 commit b5a4b60

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
- uses: Swatinem/rust-cache@v2
16+
# needed or else: `The system library `alsa` required by crate `alsa-sys` was not found.`
17+
- run: sudo apt-get update && sudo apt-get install -y libasound2-dev
18+
- run: ./ci.sh

ci.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
cargo fmt --all --check
5+
cargo clippy --all-targets --all-features -- -D warnings
6+
cargo test --all
7+
cargo doc --no-deps

src/canvas/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl std::iter::Sum for Color {
282282
#[cfg(feature = "embedded-graphics")]
283283
impl From<Color> for embedded_graphics::pixelcolor::Rgb888 {
284284
fn from(color: Color) -> Self {
285-
let (r, g, b) = color.quantize(256);
285+
let (r, g, b) = color.quantize(255);
286286
Self::new(r, g, b)
287287
}
288288
}

src/canvas/generic.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ pub struct DeviceCanvas<Spec: DeviceSpec> {
7373
}
7474

7575
impl<Spec: DeviceSpec> DeviceCanvas<Spec> {
76-
/// Create a new canvas by guessing both input and output MIDI connection by their name. If you
77-
/// need precise control over the specific MIDI connections that will be used, use
78-
/// [`DeviceCanvas::from_ports`] instead // TODO: not implemented yet
76+
/// Create a new canvas by guessing both input and output MIDI connection by their name.
7977
pub fn guess(
8078
mut callback: impl FnMut(CanvasMessage) + Send + 'static,
8179
) -> Result<Self, crate::MidiError> {

src/canvas/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ macro_rules! impl_traits_for_canvas {
3737
prelude::*,
3838
draw_target::DrawTarget,
3939
geometry::Dimensions,
40-
pixelcolor::{Rgb888, RgbColor},
40+
pixelcolor::Rgb888,
4141
primitives::rectangle::Rectangle,
4242
};
4343
}

src/canvas/pad.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ impl Pad {
107107
}
108108

109109
/// If this pad is outside the bounding rectangle, wrap it around
110-
///
111-
/// Note: if you want more fine-grained edges, use [`Canvas::wrap_edges`] instead
112110
pub fn wrap_edges(self, width: u32, height: u32) -> Pad {
113111
Pad {
114112
x: self.x.rem_euclid(width as i32),

0 commit comments

Comments
 (0)