diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b83084e..97b3a4c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -85,12 +85,7 @@ jobs: build_n_test_openharmony: strategy: matrix: - target: - [ - aarch64-unknown-linux-ohos, - armv7-unknown-linux-ohos, - x86_64-unknown-linux-ohos, - ] + target: [aarch64-unknown-linux-ohos, armv7-unknown-linux-ohos, x86_64-unknown-linux-ohos] fail-fast: false runs-on: ubuntu-latest @@ -105,9 +100,11 @@ jobs: run: | cargo install --locked ohrs rustup target add ${{ matrix.target }} - - name: clippy + - name: fmt & clippy if: ${{ !cancelled() }} - run: ohrs cargo --disable-target -- clippy --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings + run: | + ohrs cargo --disable-target -- fmt --all -- --check + ohrs cargo --disable-target -- clippy --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings - name: Build if: ${{ !cancelled() }} run: | diff --git a/src/platform/posix/mod.rs b/src/platform/posix/mod.rs index f8785a8..f943895 100644 --- a/src/platform/posix/mod.rs +++ b/src/platform/posix/mod.rs @@ -15,18 +15,8 @@ //! POSIX compliant support. mod sockaddr; -#[cfg(any( - all(target_os = "linux", not(target_env = "ohos")), - target_os = "freebsd", - target_os = "macos" -))] -pub(crate) use sockaddr::sockaddr_union; - -#[cfg(any( - all(target_os = "linux", not(target_env = "ohos")), - target_os = "macos" -))] -pub(crate) use sockaddr::ipaddr_to_sockaddr; +#[allow(unused_imports)] +pub(crate) use sockaddr::{ipaddr_to_sockaddr, sockaddr_union}; mod fd; pub(crate) use self::fd::Fd; diff --git a/src/platform/posix/sockaddr.rs b/src/platform/posix/sockaddr.rs index 7249f6f..378833e 100644 --- a/src/platform/posix/sockaddr.rs +++ b/src/platform/posix/sockaddr.rs @@ -60,10 +60,6 @@ fn rs_addr_to_sockaddr(addr: std::net::SocketAddr) -> sockaddr_union { /// # Safety /// Fill the `addr` with the `src_addr` and `src_port`, the `size` should be the size of overwriting -#[cfg(any( - all(target_os = "linux", not(target_env = "ohos")), - target_os = "macos" -))] pub(crate) unsafe fn ipaddr_to_sockaddr( src_addr: T, src_port: u16,