Skip to content

Commit 30777ca

Browse files
committed
Introduce clippy
1 parent b287a0c commit 30777ca

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Modules/cpython-sys/build.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ fn main() {
99
.expect("expected Modules/cpython-sys to live under the source tree");
1010
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
1111
let builddir = env::var("PYTHON_BUILD_DIR").ok();
12-
if gil_disabled(&srcdir, builddir.as_deref()) {
12+
if gil_disabled(srcdir, builddir.as_deref()) {
1313
println!("cargo:rustc-cfg=py_gil_disabled");
1414
}
15-
generate_c_api_bindings(srcdir, builddir.as_deref(), &out_path.as_path());
15+
generate_c_api_bindings(srcdir, builddir.as_deref(), out_path.as_path());
1616
// TODO(emmatyping): generate bindings to the internal parser API
1717
// The parser includes things slightly differently, so we should generate
1818
// it's bindings independently
@@ -27,11 +27,10 @@ fn gil_disabled(srcdir: &Path, builddir: Option<&str>) -> bool {
2727
candidates.push(srcdir.to_path_buf());
2828
for base in candidates {
2929
let path = base.join("pyconfig.h");
30-
if let Ok(contents) = std::fs::read_to_string(&path) {
31-
if contents.contains("Py_GIL_DISABLED 1") {
30+
if let Ok(contents) = std::fs::read_to_string(&path)
31+
&& contents.contains("Py_GIL_DISABLED 1") {
3232
return true;
3333
}
34-
}
3534
}
3635
false
3736
}

Modules/cpython-sys/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![allow(non_snake_case)]
44
#![allow(unsafe_op_in_unsafe_fn)]
55
#![allow(unnecessary_transmutes)]
6+
#![allow(clippy::approx_constant)]
67

78
use std::ffi::{c_char, c_int, c_void};
89

rust-toolchain.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[toolchain]
2-
channel = "1.91.1"
2+
channel = "1.91.1"
3+
components = ["clippy"]

0 commit comments

Comments
 (0)