chore: fix lints (#1162)

This commit is contained in:
Wei Zhang 2025-10-03 00:57:15 +08:00 committed by GitHub
parent da1afbde63
commit 783a3c9f53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 49 deletions

View File

@ -282,49 +282,49 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
container_build: # container_build:
name: Container Build # name: Container Build
runs-on: ${{ matrix.job.os }} # runs-on: ${{ matrix.job.os }}
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
job: # job:
- { os: ubuntu-latest, target: loongarch64-unknown-linux-gnu, platform: loong64 } # - { os: ubuntu-latest, target: loongarch64-unknown-linux-gnu, platform: loong64 }
steps: # steps:
- uses: actions/checkout@v1 # - uses: actions/checkout@v1
- name: Set up QEMU # - name: Set up QEMU
uses: docker/setup-qemu-action@v3 # uses: docker/setup-qemu-action@v3
with: # with:
image: tonistiigi/binfmt:master # image: tonistiigi/binfmt:master
- name: Containerized Build # - name: Containerized Build
# containerized build is slow, but easy to setup and cross compile # # containerized build is slow, but easy to setup and cross compile
# currently only used for: # # currently only used for:
# - loongarch64 # # - loongarch64
# # #
# tests should be done previously # # tests should be done previously
shell: bash # shell: bash
run: | # run: |
docker run --platform linux/${{ matrix.job.platform }} \ # docker run --platform linux/${{ matrix.job.platform }} \
-v `pwd`:/src \ # -v `pwd`:/src \
kweizh/loongarch-rust:v0.1.0 \ # pkgforge/alpine-rust-stable:loongarch64 \
build --release --target ${{ matrix.job.target }} # cargo build --release --target ${{ matrix.job.target }}
#
# determine EXE suffix # # determine EXE suffix
EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac; # EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
echo "EXE_suffix=${EXE_suffix}" >> $GITHUB_OUTPUT # echo "EXE_suffix=${EXE_suffix}" >> $GITHUB_OUTPUT
- name: Archive executable artifacts # - name: Archive executable artifacts
uses: actions/upload-artifact@master # uses: actions/upload-artifact@master
with: # with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }} # name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }} # path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
- name: Release # - name: Release
uses: softprops/action-gh-release@v1 # uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') # if: startsWith(github.ref, 'refs/tags/')
with: # with:
files: | # files: |
target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }} # target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
env: # env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winget: winget:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -373,8 +373,8 @@ jobs:
run: | run: |
sudo apt-get -y install libssl-dev sudo apt-get -y install libssl-dev
pushd '${{ steps.vars.outputs.STAGING }}/work' >/dev/null pushd '${{ steps.vars.outputs.STAGING }}/work' >/dev/null
wget --no-verbose https://github.com/xd009642/tarpaulin/releases/download/0.13.3/cargo-tarpaulin-0.13.3-travis.tar.gz wget --no-verbose https://github.com/xd009642/tarpaulin/releases/download/0.32.8/cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz
tar xf cargo-tarpaulin-0.13.3-travis.tar.gz tar xf cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz
cp cargo-tarpaulin "$(dirname -- "$(which cargo)")"/ cp cargo-tarpaulin "$(dirname -- "$(which cargo)")"/
popd >/dev/null popd >/dev/null
- name: Generate coverage - name: Generate coverage

View File

@ -128,7 +128,7 @@ pub fn get_file_data(path: &Path) -> Result<(Owner, Permissions), io::Error> {
// Failed to create the SID // Failed to create the SID
// Assumptions: Same as the other identical calls // Assumptions: Same as the other identical calls
unsafe { unsafe {
windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0 as isize))); windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0)));
} }
// Assumptions: None (GetLastError shouldn't ever fail) // Assumptions: None (GetLastError shouldn't ever fail)
@ -184,7 +184,7 @@ pub fn get_file_data(path: &Path) -> Result<(Owner, Permissions), io::Error> {
// options. It's not much memory, so leaking it on failure is // options. It's not much memory, so leaking it on failure is
// *probably* fine) // *probably* fine)
unsafe { unsafe {
windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0 as isize))); windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0)));
} }
Ok((owner, permissions)) Ok((owner, permissions))
@ -227,7 +227,9 @@ unsafe fn get_acl_access_mask(
unsafe fn trustee_from_sid<P: Into<PSID>>(sid_ptr: P) -> TRUSTEE_W { unsafe fn trustee_from_sid<P: Into<PSID>>(sid_ptr: P) -> TRUSTEE_W {
let mut trustee = TRUSTEE_W::default(); let mut trustee = TRUSTEE_W::default();
Security::Authorization::BuildTrusteeWithSidW(&mut trustee, Some(sid_ptr.into())); unsafe {
Security::Authorization::BuildTrusteeWithSidW(&mut trustee, Some(sid_ptr.into()));
}
trustee trustee
} }
@ -375,7 +377,7 @@ mod test {
let mut vec: Vec<u16> = Vec::with_capacity(257); let mut vec: Vec<u16> = Vec::with_capacity(257);
for msb in 0..=256u16 { for msb in 0..=256u16 {
let val = msb << 8 | lsb; let val = (msb << 8) | lsb;
if val != 0 { if val != 0 {
vec.push(val) vec.push(val)