WEFT_OS/scripts/wsl-check.sh
Marco Allegretti 732e572c43 fix(compositor): resolve all Linux cargo check/clippy/fmt failures
Fixes found by running cargo check + clippy -D warnings + fmt --check
on openSUSE Tumbleweed WSL2 (Rust 1.93.0).

input.rs:
- Add GestureBeginEvent (fingers()), GestureEndEvent (cancelled()),
 TouchEvent (slot()) supertrait imports
- Add explicit ::<B> turbofish to all handle_* dispatch calls Rust
 cannot reverse-infer B from an associated type bound
- Remove now-redundant specific gesture/touch event trait imports

state.rs:
- Add reposition_request to XdgShellHandler (E0046)
- Wrap protocol-level LayerSurface in desktop::LayerSurface::new for
 map_layer (E0308)
- Wrap std::env::set_var in unsafe block (E0133, stabilised unsafe in 1.80)
- Add #[allow(dead_code)] on WeftCompositorState protocol state fields
 are held for delegate dispatch, not yet consumed
- Remove spurious mut on display binding

drm.rs:
- Revert initialize_output arg to &output (&Output: Into<OutputModeSource>)
- Specify element type via ::<_, WaylandSurfaceRenderElement<_>> turbofish
 on initialize_output (E0277/E0308)
- Handle Result from scan_connectors, collect via IntoIterator (E0308)
- Wrap set_var in unsafe block; remove spurious mut on display
- Collapse nested if/if-let blocks per clippy::collapsible_if
- Remove useless .into() on render_node (clippy::useless_conversion)

drm_device.rs:
- Add #[allow(dead_code)] on WeftOutputSurface (device_id, global used
 in hotplug handling)

scripts/wsl-check.sh (new):
- WSL2 helper: injects libdisplay-info 0.2.9 shim .pc to satisfy the
 < 0.3.0 constraint while openSUSE ships 0.3.0; runs check/clippy/fmt
2026-03-10 23:43:43 +01:00

43 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -e
PROJECT="/mnt/c/Users/might/Desktop/Development/Systems/WEFT OS"
# ── Fake libdisplay-info.pc that reports 0.2.9 ───────────────────────────────
# libdisplay-info-sys 0.2.2 requires >= 0.1.0 < 0.3.0; openSUSE ships 0.3.0.
# cargo check does not link, so reporting 0.2.9 satisfies the version guard
# without requiring a source build.
FAKE_PC_DIR="$HOME/.local/fake-pkgconfig"
mkdir -p "$FAKE_PC_DIR"
cat > "$FAKE_PC_DIR/libdisplay-info.pc" << 'EOF'
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=/usr/include
Name: libdisplay-info
Description: EDID and DisplayID library (version shim for cargo check)
Version: 0.2.9
Libs: -L${libdir} -ldisplay-info
Cflags: -I${includedir}
EOF
echo "==> libdisplay-info shim: $(pkg-config --modversion libdisplay-info --with-path "$FAKE_PC_DIR" 2>/dev/null || echo written)"
# ── cargo check ───────────────────────────────────────────────────────────────
source "$HOME/.cargo/env"
export PKG_CONFIG_PATH="$FAKE_PC_DIR:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
cd "$PROJECT"
echo ""
echo "==> cargo check -p weft-compositor"
cargo check -p weft-compositor 2>&1
echo ""
echo "==> cargo clippy -p weft-compositor -- -D warnings"
cargo clippy -p weft-compositor -- -D warnings 2>&1
echo ""
echo "==> cargo fmt --check -p weft-compositor"
cargo fmt --check -p weft-compositor 2>&1
echo ""
echo "ALL DONE"