Merge pull request #4214 from youknowone/platform-clippy

Add platform-dependent clippy running to CI
This commit is contained in:
Jeong YunWon authored and GitHub committed 2022-10-15 17:13:42 +09:00
commit 1cb7f4dcf8
5 files changed
+23 -17

No files matched your search

+6 -2
View File
@@ -118,6 +118,8 @@ jobs:
path: compiler/parser/python.rs
key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Set up the Windows environment
shell: bash
run: |
@@ -128,6 +130,10 @@ jobs:
run: brew install autoconf automake libtool
if: runner.os == 'macOS'
- uses: Swatinem/rust-cache@v1
- name: run clippy
run: cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
- name: run rust tests
run: cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
- name: check compilation without threading
@@ -331,8 +337,6 @@ jobs:
components: rustfmt, clippy
- name: run rustfmt
run: cargo fmt --all -- --check
- name: run clippy
run: cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
- name: run clippy on wasm
run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
- uses: actions/setup-python@v2
+13 -11
View File
@@ -163,22 +163,24 @@ mod fcntl {
whence: OptionalArg<i32>,
vm: &VirtualMachine,
) -> PyResult {
macro_rules! try_into_l_type {
($l_type:path) => {
$l_type
.try_into()
.map_err(|e| vm.new_overflow_error(format!("{e}")))
};
}
let mut l: libc::flock = unsafe { std::mem::zeroed() };
if cmd == libc::LOCK_UN {
l.l_type = libc::F_UNLCK
.try_into()
.map_err(|e| vm.new_overflow_error(format!("{e}")))?;
l.l_type = if cmd == libc::LOCK_UN {
try_into_l_type!(libc::F_UNLCK)
} else if (cmd & libc::LOCK_SH) != 0 {
l.l_type = libc::F_RDLCK
.try_into()
.map_err(|e| vm.new_overflow_error(format!("{e}")))?;
try_into_l_type!(libc::F_RDLCK)
} else if (cmd & libc::LOCK_EX) != 0 {
l.l_type = libc::F_WRLCK
.try_into()
.map_err(|e| vm.new_overflow_error(format!("{e}")))?;
try_into_l_type!(libc::F_WRLCK)
} else {
return Err(vm.new_value_error("unrecognized lockf argument".to_owned()));
}
}?;
l.l_start = match start {
OptionalArg::Present(s) => s.try_to_primitive(vm)?,
OptionalArg::Missing => 0,
+1 -1
View File
@@ -1445,7 +1445,7 @@ mod windows {
.iter()
.filter_map(|open| open(store_name.as_str()).ok())
.collect::<Vec<_>>();
let certs = stores.iter().map(|s| s.certs()).flatten().map(|c| {
let certs = stores.iter().flat_map(|s| s.certs()).map(|c| {
let cert = vm.ctx.new_bytes(c.to_der().to_owned());
let enc_type = unsafe {
let ptr = c.as_ptr() as wincrypt::PCCERT_CONTEXT;
+1 -1
View File
@@ -431,6 +431,6 @@ mod _winapi {
}
let (path, _) = path.split_at(length as usize);
Ok(String::from_utf16(&path).unwrap())
Ok(String::from_utf16(path).unwrap())
}
}
+2 -2
View File
@@ -191,7 +191,7 @@ mod winreg {
key.with_key(|k| k.get_raw_value(subkey))
.map_err(|e| e.to_pyexception(vm))
.and_then(|regval| {
let ty = regval.vtype.clone() as usize;
let ty = regval.vtype as usize;
Ok((reg_to_py(regval, vm)?, ty))
})
}
@@ -221,7 +221,7 @@ mod winreg {
})
.map_err(|e| e.to_pyexception(vm))
.and_then(|(name, value)| {
let ty = value.vtype.clone() as usize;
let ty = value.vtype as usize;
Ok((name, reg_to_py(value, vm)?, ty))
})
}