Skip to content

Commit

Permalink
[1/n] [ci] update MSRV and test on it, add clippy, fix clippy warnings (
Browse files Browse the repository at this point in the history
#70)

Clippy flagged an outdated MSRV -- update to the version currently in Omicron,
and add CI for the various permutations.

Also allow `/target` to be a symlink -- this is the setup I use.
  • Loading branch information
sunshowers authored Dec 20, 2024
1 parent 13afd8c commit fccfc45
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
#
name: Rust

env:
RUSTFLAGS: -D warnings

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allow CI to run on all PRs, not just ones targeting main. This allows
# stacked PRs to be tested.

jobs:
check-style:
Expand All @@ -22,15 +26,22 @@ jobs:
components: rustfmt
- name: Check style
run: cargo fmt -- --check
- name: Check clippy
run: cargo clippy --all-targets --all-features

build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# 1.81 is the MSRV.
toolchain: [ stable, "1.81" ]
os: [ ubuntu-latest, macos-latest ]
steps:
# actions/checkout@v2
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
- name: Build
run: cargo build --tests --verbose
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Cargo
# will have compiled files and executables
/target/
/target

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand Down
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ name = "omicron-zone-package"
version = "0.11.1"
authors = ["Sean Klein <[email protected]>"]
edition = "2021"
#
# Report a specific error in the case that the toolchain is too old for
# let-else:
#
rust-version = "1.65.0"
rust-version = "1.81.0"
license = "MPL-2.0"
repository = "https://github.com/oxidecomputer/omicron-package"
description = "Packaging tools for Oxide's control plane software"
Expand Down
1 change: 0 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ impl Config {
self.packages
.iter()
.filter(|(_, pkg)| target.includes_package(pkg))
.map(|(name, pkg)| (name, pkg))
.collect(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub struct BuildConfig<'a> {
static DEFAULT_TARGET: Target = Target(BTreeMap::new());
static DEFAULT_PROGRESS: NoProgress = NoProgress::new();

impl<'a> Default for BuildConfig<'a> {
impl Default for BuildConfig<'_> {
fn default() -> Self {
Self {
target: &DEFAULT_TARGET,
Expand Down

0 comments on commit fccfc45

Please sign in to comment.