Skip to content

Commit

Permalink
ci: use stable toolchain to run clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mfontanini committed Feb 1, 2025
1 parent 3a389c1 commit 7643b8f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 49 deletions.
31 changes: 8 additions & 23 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,33 @@ name: Merge checks

jobs:
check:
name: Check
name: Checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install rust toolchain
uses: dtolnay/[email protected]
with:
components: clippy

- name: Run cargo check
run: cargo check --features sixel

test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install rust toolchain
uses: dtolnay/[email protected]

- name: Run cargo test
run: cargo test

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Run cargo clippy
run: cargo clippy -- -D warnings

- name: Install stable toolchain
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
components: rustfmt

- name: Run cargo fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy -- -D warnings
run: cargo +nightly fmt --all -- --check

nix-flake:
name: Validate nix flake
Expand Down
11 changes: 4 additions & 7 deletions src/code/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,10 @@ mod test {
#[test]
fn highlight_line_range() {
let attributes = parse_attributes("bash { 1, 2-4,6 , all , 10 - 12 }");
assert_eq!(attributes.highlight_groups, &[HighlightGroup::new(vec![
Single(1),
Range(2..5),
Single(6),
All,
Range(10..13)
])]);
assert_eq!(
attributes.highlight_groups,
&[HighlightGroup::new(vec![Single(1), Range(2..5), Single(6), All, Range(10..13)])]
);
}

#[test]
Expand Down
17 changes: 8 additions & 9 deletions src/presentation/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,11 +1685,10 @@ mod test {
#[test]
fn iterate_list_starting_from_other() {
let list = ListIterator::new(
vec![ListItem { depth: 0, contents: "0".into(), item_type: ListItemType::Unordered }, ListItem {
depth: 0,
contents: "1".into(),
item_type: ListItemType::Unordered,
}],
vec![
ListItem { depth: 0, contents: "0".into(), item_type: ListItemType::Unordered },
ListItem { depth: 0, contents: "1".into(), item_type: ListItemType::Unordered },
],
3,
);
let expected_indexes = [3, 4];
Expand Down Expand Up @@ -1776,10 +1775,10 @@ mod test {

#[test]
fn implicit_slide_ends_with_front_matter() {
let elements =
vec![MarkdownElement::FrontMatter("theme:\n name: light".into()), MarkdownElement::SetexHeading {
text: "hi".into(),
}];
let elements = vec![
MarkdownElement::FrontMatter("theme:\n name: light".into()),
MarkdownElement::SetexHeading { text: "hi".into() },
];
let options = PresentationBuilderOptions { implicit_slide_ends: true, ..Default::default() };
let slides = build_presentation_with_options(elements, options).into_slides();
assert_eq!(slides.len(), 1);
Expand Down
15 changes: 9 additions & 6 deletions src/ui/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,15 @@ impl AsRenderOperations for RunImageSnippet {
match state.deref() {
RunImageSnippetState::NotStarted | RunImageSnippetState::Running(_) => vec![],
RunImageSnippetState::Success(image) => {
vec![RenderOperation::RenderImage(image.clone(), ImageRenderProperties {
z_index: 0,
size: ImageSize::ShrinkIfNeeded,
restore_cursor: false,
background_color: None,
})]
vec![RenderOperation::RenderImage(
image.clone(),
ImageRenderProperties {
z_index: 0,
size: ImageSize::ShrinkIfNeeded,
restore_cursor: false,
background_color: None,
},
)]
}
RunImageSnippetState::Failure(lines) => {
let mut output = Vec::new();
Expand Down
11 changes: 7 additions & 4 deletions src/ui/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ impl AsRenderOperations for FooterGenerator {
let columns_ratio = (total_columns as f64 * progress_ratio).ceil();
let bar = character.repeat(columns_ratio as usize);
let bar = Text::new(bar, TextStyle::default().colors(*colors));
vec![RenderOperation::JumpToBottomRow { index: 0 }, RenderOperation::RenderText {
line: vec![bar].into(),
alignment: Alignment::Left { margin: Margin::Fixed(0) },
}]
vec![
RenderOperation::JumpToBottomRow { index: 0 },
RenderOperation::RenderText {
line: vec![bar].into(),
alignment: Alignment::Left { margin: Margin::Fixed(0) },
},
]
}
FooterStyle::Empty => vec![],
}
Expand Down

0 comments on commit 7643b8f

Please sign in to comment.