Skip to content

Commit

Permalink
Merge pull request #955 from Alexander-N/clippy
Browse files Browse the repository at this point in the history
Small cleanup
  • Loading branch information
kngwyu authored Jun 5, 2020
2 parents 75b2b62 + bcf48c0 commit be1b704
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
.PHONY: test test_py3 publish clippy lint fmt
.PHONY: test test_py publish clippy lint fmt

# Constant used in clippy target
CLIPPY_LINTS_TO_DENY := warnings

test:
test: lint test_py
cargo test
${MAKE} clippy
tox
for example in examples/*; do tox -e py -c $$example/tox.ini || exit 1; done

test_py3:
tox -e py3
for example in examples/*; do tox -e py3 -c $$example/tox.ini || exit 1; done
test_py:
tox -e py
for example in examples/*; do tox -e py -c $$example/tox.ini || exit 1; done

fmt:
cargo fmt --all -- --check
Expand All @@ -21,6 +18,7 @@ clippy:
@touch src/lib.rs # Touching file to ensure that cargo clippy will re-check the project
cargo clippy --all-features --all-targets -- \
$(addprefix -D ,${CLIPPY_LINTS_TO_DENY})
for example in examples/*; do (cd $$example/; cargo clippy) || exit 1; done

lint: fmt clippy
@true
Expand Down
1 change: 1 addition & 0 deletions examples/rustapi_module/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ fn get_delta_tuple<'p>(py: Python<'p>, delta: &PyDelta) -> &'p PyTuple {
)
}

#[allow(clippy::too_many_arguments)]
#[pyfunction]
fn make_datetime<'p>(
py: Python<'p>,
Expand Down
2 changes: 1 addition & 1 deletion examples/word-count/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn matches(word: &str, needle: &str) -> bool {
}
}
}
return needle.next().is_none();
needle.next().is_none()
}

/// Count the occurences of needle in line, case insensitive
Expand Down
1 change: 1 addition & 0 deletions src/gil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ mod test {
// Move obj to a thread which does not have the GIL, and clone it
let t = std::thread::spawn(move || {
// Cloning without GIL should not update reference count
#[allow(clippy::redundant_clone)]
let _ = obj.clone();
assert_eq!(count, obj.get_refcnt());

Expand Down
1 change: 0 additions & 1 deletion tests/test_pyself.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Test slf: PyRef/PyMutRef<Self>(especially, slf.into::<Py>) works
use pyo3;
use pyo3::prelude::*;
use pyo3::types::{PyBytes, PyString};
use pyo3::{AsPyRef, PyCell, PyIterProtocol};
Expand Down

0 comments on commit be1b704

Please sign in to comment.