Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): fix rust ci warnings #408

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions .github/workflows/preview-deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: aarch64-apple-darwin
profile: minimal
default: true
targets: aarch64-apple-darwin
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: -i python --release --out dist --no-sdist
- name: Build wheels - universal2
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
args: -i python --release --universal2 --out dist --no-sdist
- name: Upload wheels
Expand All @@ -51,14 +47,9 @@ jobs:
with:
python-version: "3.7"
architecture: ${{ matrix.target }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: -i python3.7 --release --out dist --no-sdist
Expand All @@ -75,17 +66,12 @@ jobs:
target: [x86_64, i686]
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
Expand All @@ -105,7 +91,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
env:
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}/lib
with:
Expand Down
32 changes: 9 additions & 23 deletions .github/workflows/release-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: aarch64-apple-darwin
profile: minimal
default: true
targets: aarch64-apple-darwin
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: -i python --release --out dist
Expand All @@ -35,7 +31,7 @@ jobs:
pip install --force-reinstall dist/robyn*.whl
cd ~ && python -c 'import robyn'
- name: Build wheels - universal2
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
args: -i python --release --universal2 --out dist
- name: Install build wheel - universal2
Expand All @@ -60,14 +56,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: -i python --release --out dist
Expand All @@ -90,17 +81,12 @@ jobs:
target: [x86_64, i686]
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
Expand Down Expand Up @@ -132,7 +118,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build Wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
env:
PYO3_CROSS_LIB_DIR: /opt/python/${{ matrix.python.abi }}/lib
with:
Expand Down
52 changes: 14 additions & 38 deletions .github/workflows/rust-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,34 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo test

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
command: fmt
args: --all -- --check
components: rustfmt
- run: cargo fmt --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
command: clippy
args: -- -D warnings
components: clippy
- run: cargo clippy -- -D warnings
21 changes: 11 additions & 10 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use core::{mem};
use core::mem;
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};
use std::{
convert::Infallible,
task::{Context, Poll},
pin::Pin,
task::{Context, Poll},
};
use std::collections::HashMap;

use actix_http::body::BodySize;
use actix_http::body::MessageBody;
use actix_web::web::Bytes;
use actix_web::{http::Method, HttpRequest};
use actix_http::body::MessageBody;
use actix_http::body::BodySize;

use anyhow::Result;
use dashmap::DashMap;
use pyo3::{exceptions, prelude::*};
use pyo3::types::{PyBytes, PyString};
use pyo3::exceptions::PyValueError;
use pyo3::types::{PyBytes, PyString};
use pyo3::{exceptions, prelude::*};

use crate::io_helpers::read_file;

Expand All @@ -36,9 +36,10 @@ impl ActixBytesWrapper {
} else if let Ok(v) = raw_body.downcast::<PyBytes>() {
v.as_bytes().to_vec()
} else {
return Err(PyValueError::new_err(
format!("Could not convert {} specified body to bytes", type_of(raw_body))
));
return Err(PyValueError::new_err(format!(
"Could not convert {} specified body to bytes",
type_of(raw_body)
)));
};
Ok(Self(Bytes::from(value)))
}
Expand Down