Skip to content

Commit

Permalink
Merge pull request #3898 from cgwalters/clippy-lints-2
Browse files Browse the repository at this point in the history
Fix remaining clippy lints + add CI
  • Loading branch information
Luca Bruno authored Aug 3, 2022
2 parents bd83a01 + a5d3551 commit 9ef9215
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ on:
permissions:
contents: read

env:
CARGO_TERM_COLOR: always
# Minimum supported Rust version (MSRV)
ACTION_MSRV_TOOLCHAIN: 1.60.0
# Pinned toolchain for linting
ACTION_LINTS_TOOLCHAIN: 1.60.0

jobs:
build:
name: "Build"
Expand Down Expand Up @@ -42,6 +49,32 @@ jobs:
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Codestyle
run: ./ci/verify-cxx.sh
# TODO: Enable this once we've switched closer to having `cargo build`
# be the primary buildsystem entrypoint. Right now the problem is
# in order to build the libdnf-sys dependency it relies on us having
# run through autoconf, but that flow wants to a "real" Rust build
# and not clippy.
# linting:
# name: "Lints, pinned toolchain"
# runs-on: ubuntu-latest
# container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# - name: Install dependencies
# run: ./ci/installdeps.sh
# - name: Remove system Rust toolchain
# run: dnf remove -y rust cargo
# - name: Install toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ env['ACTION_LINTS_TOOLCHAIN'] }}
# default: true
# components: rustfmt, clippy
# - name: cargo fmt (check)
# run: cargo fmt -- --check -l
# - name: cargo clippy (warnings)
# run: cargo clippy -- -D warnings
build-clang:
name: "Build (clang)"
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion rust/src/cxxrsutil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ macro_rules! impl_wrap {

fn reborrow_cxx(&'a self) -> &Self::ReWrapped {
let p: *const $sys = self.to_glib_none().0;
unsafe { std::mem::transmute(p) }
let p = p as *const Self::ReWrapped;
unsafe { &*p }
}
}
};
Expand Down
1 change: 1 addition & 0 deletions rust/src/treefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ impl Treefile {
add_sha256_nevra_to_map(map, packages)
}

#[allow(clippy::if_same_then_else)]
pub(crate) fn remove_packages(
&mut self,
packages: Vec<String>,
Expand Down

0 comments on commit 9ef9215

Please sign in to comment.