ci: deny clippy warnings for examples

This commit is contained in:
David Hewitt 2020-12-31 22:09:25 +00:00
parent 1d8c14a5ca
commit 0da12bd0dc
2 changed files with 6 additions and 10 deletions

View File

@ -12,8 +12,9 @@ fmt:
clippy: clippy:
@touch src/lib.rs # Touching file to ensure that cargo clippy will re-check the project @touch src/lib.rs # Touching file to ensure that cargo clippy will re-check the project
cargo clippy --features="default num-bigint num-complex" --tests -- -Dwarnings cargo clippy --features="num-bigint num-complex hashbrown" --tests -- -Dwarnings
for example in examples/*; do (cd $$example/; cargo clippy) || exit 1; done cargo clippy --features="abi3 num-bigint num-complex hashbrown" --tests -- -Dwarnings
for example in examples/*; do cargo clippy --manifest-path $$example/Cargo.toml -- -Dwarnings || exit 1; done
lint: fmt clippy lint: fmt clippy
@true @true

View File

@ -6,7 +6,7 @@ use pyo3::types::{
use pyo3::wrap_pyfunction; use pyo3::wrap_pyfunction;
#[pyfunction] #[pyfunction]
fn make_date<'p>(py: Python<'p>, year: i32, month: u8, day: u8) -> PyResult<&'p PyDate> { fn make_date(py: Python, year: i32, month: u8, day: u8) -> PyResult<&PyDate> {
PyDate::new(py, year, month, day) PyDate::new(py, year, month, day)
} }
@ -19,7 +19,7 @@ fn get_date_tuple<'p>(py: Python<'p>, d: &PyDate) -> &'p PyTuple {
} }
#[pyfunction] #[pyfunction]
fn date_from_timestamp<'p>(py: Python<'p>, timestamp: i64) -> PyResult<&'p PyDate> { fn date_from_timestamp(py: Python, timestamp: i64) -> PyResult<&PyDate> {
PyDate::from_timestamp(py, timestamp) PyDate::from_timestamp(py, timestamp)
} }
@ -93,12 +93,7 @@ fn get_time_tuple_fold<'p>(py: Python<'p>, dt: &PyTime) -> &'p PyTuple {
} }
#[pyfunction] #[pyfunction]
fn make_delta<'p>( fn make_delta(py: Python, days: i32, seconds: i32, microseconds: i32) -> PyResult<&PyDelta> {
py: Python<'p>,
days: i32,
seconds: i32,
microseconds: i32,
) -> PyResult<&'p PyDelta> {
PyDelta::new(py, days, seconds, microseconds, true) PyDelta::new(py, days, seconds, microseconds, true)
} }