ci: run clippy on all platforms (#3650)

This commit is contained in:
Tony authored and GitHub committed 2026-09-29 17:08:34 +02:00
1 parent 43538190b6
commit 29130c2ed2
5 files changed
+48 -21

No files matched your search

+29 -5
View File
@@ -149,24 +149,48 @@ jobs:
clippy: clippy:
needs: changes needs: changes
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }} if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
runs-on: ubuntu-22.04 runs-on: ${{ matrix.platform.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }} package: ${{ fromJSON(needs.changes.outputs.packages) }}
platform:
- target: x86_64-pc-windows-msvc
os: windows-latest
cargo: 'cargo'
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cargo: 'cargo'
- target: aarch64-apple-darwin
os: macos-latest
cargo: 'cargo'
- target: aarch64-apple-ios
os: macos-latest
cargo: 'cargo'
- target: aarch64-linux-android
os: ubuntu-latest
cargo: 'cross'
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- name: install webkit2gtk - name: install Linux dependencies
if: contains(matrix.platform.target, 'unknown-linux')
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev
- name: Install cross
if: ${{ matrix.platform.cargo == 'cross' }}
uses: taiki-e/install-action@v2
with:
tool: cross@0.2.5
- name: Install clippy with stable toolchain - name: Install clippy with stable toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
components: clippy components: clippy
targets: ${{ matrix.platform.target }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -176,8 +200,8 @@ jobs:
save-if: ${{ (github.ref == 'refs/heads/v2' || github.ref == 'refs/heads/v3') && matrix.package == needs.changes.outputs.saver }} save-if: ${{ (github.ref == 'refs/heads/v2' || github.ref == 'refs/heads/v3') && matrix.package == needs.changes.outputs.saver }}
- name: clippy ${{ matrix.package }} - name: clippy ${{ matrix.package }}
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings run: ${{ matrix.platform.cargo }} clippy --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets -- -D warnings
- name: clippy ${{ matrix.package }} --all-features - name: clippy ${{ matrix.package }} --all-features
if: matrix.package != 'tauri-plugin-dialog' if: matrix.package != 'tauri-plugin-dialog'
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings run: ${{ matrix.platform.cargo }} clippy --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features -- -D warnings
+1 -1
View File
@@ -6,7 +6,7 @@ members = [
"plugins/*/examples/*/src-tauri", "plugins/*/examples/*/src-tauri",
"examples/*/src-tauri", "examples/*/src-tauri",
] ]
resolver = "2" resolver = "3"
[workspace.dependencies] [workspace.dependencies]
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
+3
View File
@@ -26,6 +26,9 @@ export default defineConfig(async () => {
host: host || false, host: host || false,
port: 5173, port: 5173,
strictPort: true, strictPort: true,
watch: {
ignored: ['**/src-tauri/**']
},
fs: { fs: {
allow: ['.'] allow: ['.']
} }
@@ -40,11 +40,11 @@ struct UserData<R: Runtime> {
impl<R: Runtime> UserData<R> { impl<R: Runtime> UserData<R> {
unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self { unsafe fn from_hwnd_raw(hwnd: HWND) -> *mut Self {
GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self unsafe { GetWindowLongPtrW(hwnd, GWLP_USERDATA) as *mut Self }
} }
unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self { unsafe fn from_hwnd<'a>(hwnd: HWND) -> &'a mut Self {
&mut *Self::from_hwnd_raw(hwnd) unsafe { &mut *Self::from_hwnd_raw(hwnd) }
} }
fn run_callback(&mut self, args: Vec<String>, cwd: String) { fn run_callback(&mut self, args: Vec<String>, cwd: String) {
@@ -147,18 +147,18 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
) -> LRESULT { ) -> LRESULT {
match msg { match msg {
WM_CREATE => { WM_CREATE => {
let create_struct = &*(lparam as *const CREATESTRUCTW); let create_struct = unsafe { &*(lparam as *const CREATESTRUCTW) };
let userdata = create_struct.lpCreateParams as *const UserData<R>; let userdata = create_struct.lpCreateParams as *const UserData<R>;
SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _); unsafe { SetWindowLongPtrW(hwnd, GWLP_USERDATA, userdata as _) };
0 0
} }
WM_COPYDATA => { WM_COPYDATA => {
let cds_ptr = lparam as *const COPYDATASTRUCT; let cds_ptr = lparam as *const COPYDATASTRUCT;
if (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA { if unsafe { (*cds_ptr).dwData == WMCOPYDATA_SINGLE_INSTANCE_DATA } {
let userdata = UserData::<R>::from_hwnd(hwnd); let userdata = unsafe { UserData::<R>::from_hwnd(hwnd) };
let data = CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy(); let data = unsafe { CStr::from_ptr((*cds_ptr).lpData as _).to_string_lossy() };
let mut s = data.split('|'); let mut s = data.split('|');
let cwd = s.next().unwrap(); let cwd = s.next().unwrap();
let args = s.map(|s| s.to_string()).collect(); let args = s.map(|s| s.to_string()).collect();
@@ -169,11 +169,11 @@ unsafe extern "system" fn single_instance_window_proc<R: Runtime>(
} }
WM_DESTROY => { WM_DESTROY => {
let userdata = UserData::<R>::from_hwnd_raw(hwnd); let userdata = unsafe { UserData::<R>::from_hwnd_raw(hwnd) };
drop(Box::from_raw(userdata)); drop(unsafe { Box::from_raw(userdata) });
0 0
} }
_ => DefWindowProcW(hwnd, msg, wparam, lparam), _ => unsafe { DefWindowProcW(hwnd, msg, wparam, lparam) },
} }
} }
@@ -245,23 +245,23 @@ pub fn encode_wide(string: impl AsRef<std::ffi::OsStr>) -> Vec<u16> {
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize { unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
w32wm::SetWindowLongW(hwnd, index, value as _) as _ unsafe { w32wm::SetWindowLongW(hwnd, index, value as _) as _ }
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize { unsafe fn SetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX, value: isize) -> isize {
w32wm::SetWindowLongPtrW(hwnd, index, value) unsafe { w32wm::SetWindowLongPtrW(hwnd, index, value) }
} }
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize { unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
w32wm::GetWindowLongW(hwnd, index) as _ unsafe { w32wm::GetWindowLongW(hwnd, index) as _ }
} }
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize { unsafe fn GetWindowLongPtrW(hwnd: HWND, index: WINDOW_LONG_PTR_INDEX) -> isize {
w32wm::GetWindowLongPtrW(hwnd, index) unsafe { w32wm::GetWindowLongPtrW(hwnd, index) }
} }
+1 -1
View File
@@ -1963,7 +1963,7 @@ mod tests {
assert_eq!(cases.len(), cases_escaped.len()); assert_eq!(cases.len(), cases_escaped.len());
for (orig, escaped) in cases.iter().zip(cases_escaped) { for (orig, escaped) in cases.iter().zip(cases_escaped) {
assert_eq!(escape_nsis_current_exe_arg(&OsStr::new(orig)), escaped); assert_eq!(escape_nsis_current_exe_arg(OsStr::new(orig)), escaped);
} }
} }
} }