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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
container_build:
name: Container Build
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest, target: loongarch64-unknown-linux-gnu, platform: loong64 }
steps:
- uses: actions/checkout@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:master
- name: Containerized Build
# containerized build is slow, but easy to setup and cross compile
# currently only used for:
# - loongarch64
#
# tests should be done previously
shell: bash
run: |
docker run --platform linux/${{ matrix.job.platform }} \
-v `pwd`:/src \
kweizh/loongarch-rust:v0.1.0 \
build --release --target ${{ matrix.job.target }}
# determine EXE suffix
EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
echo "EXE_suffix=${EXE_suffix}" >> $GITHUB_OUTPUT
- name: Archive executable artifacts
uses: actions/upload-artifact@master
with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# container_build:
# name: Container Build
# runs-on: ${{ matrix.job.os }}
# strategy:
# fail-fast: false
# matrix:
# job:
# - { os: ubuntu-latest, target: loongarch64-unknown-linux-gnu, platform: loong64 }
# steps:
# - uses: actions/checkout@v1
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# image: tonistiigi/binfmt:master
# - name: Containerized Build
# # containerized build is slow, but easy to setup and cross compile
# # currently only used for:
# # - loongarch64
# #
# # tests should be done previously
# shell: bash
# run: |
# docker run --platform linux/${{ matrix.job.platform }} \
# -v `pwd`:/src \
# pkgforge/alpine-rust-stable:loongarch64 \
# cargo build --release --target ${{ matrix.job.target }}
#
# # determine EXE suffix
# EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
# echo "EXE_suffix=${EXE_suffix}" >> $GITHUB_OUTPUT
# - name: Archive executable artifacts
# uses: actions/upload-artifact@master
# with:
# name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
# path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
# - name: Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: |
# target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winget:
runs-on: ubuntu-latest
@ -373,8 +373,8 @@ jobs:
run: |
sudo apt-get -y install libssl-dev
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
tar xf 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-x86_64-unknown-linux-musl.tar.gz
cp cargo-tarpaulin "$(dirname -- "$(which cargo)")"/
popd >/dev/null
- 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
// Assumptions: Same as the other identical calls
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)
@ -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
// *probably* fine)
unsafe {
windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0 as isize)));
windows::Win32::Foundation::LocalFree(Some(HLOCAL(sd_ptr.0)));
}
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 {
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
}
@ -375,7 +377,7 @@ mod test {
let mut vec: Vec<u16> = Vec::with_capacity(257);
for msb in 0..=256u16 {
let val = msb << 8 | lsb;
let val = (msb << 8) | lsb;
if val != 0 {
vec.push(val)