Fix some clippy and dead code warnings.
This commit is contained in:
parent
f5f47bebcb
commit
9990bf9d31
|
@ -885,7 +885,7 @@ fn search_lib_dir(path: impl AsRef<Path>, cross: &CrossCompileConfig) -> Vec<Pat
|
|||
} else {
|
||||
"python3.".into()
|
||||
};
|
||||
for f in fs::read_dir(path).expect("Path does not exist").into_iter() {
|
||||
for f in fs::read_dir(path).expect("Path does not exist") {
|
||||
sysconfig_paths.extend(match &f {
|
||||
// Python 3.7+ sysconfigdata with platform specifics
|
||||
Ok(f) if starts_with(f, "_sysconfigdata_") && ends_with(f, "py") => vec![f.path()],
|
||||
|
|
|
@ -392,7 +392,7 @@ pub fn build_py_enum(
|
|||
let variants: Vec<PyClassEnumVariant> = enum_
|
||||
.variants
|
||||
.iter()
|
||||
.map(|v| extract_variant_data(v))
|
||||
.map(extract_variant_data)
|
||||
.collect::<syn::Result<_>>()?;
|
||||
impl_enum(enum_, args, variants, method_type)
|
||||
}
|
||||
|
|
|
@ -77,11 +77,7 @@ pub fn get_doc(
|
|||
syn::token::Bracket(Span::call_site()).surround(&mut tokens, |tokens| {
|
||||
if let Some((python_name, text_signature)) = text_signature {
|
||||
// create special doc string lines to set `__text_signature__`
|
||||
let signature_lines = format!(
|
||||
"{}{}\n--\n\n",
|
||||
python_name.to_string(),
|
||||
text_signature.lit.value()
|
||||
);
|
||||
let signature_lines = format!("{}{}\n--\n\n", python_name, text_signature.lit.value());
|
||||
signature_lines.to_tokens(tokens);
|
||||
comma.to_tokens(tokens);
|
||||
}
|
||||
|
|
|
@ -440,7 +440,7 @@ impl PyErr {
|
|||
pub fn cause(&self, py: Python) -> Option<PyErr> {
|
||||
let ptr = unsafe { ffi::PyException_GetCause(self.pvalue(py).as_ptr()) };
|
||||
let obj = unsafe { py.from_owned_ptr_or_opt::<PyAny>(ptr) };
|
||||
obj.map(|x| Self::from_instance(x))
|
||||
obj.map(Self::from_instance)
|
||||
}
|
||||
|
||||
/// Set the cause associated with the exception, pass `None` to clear it.
|
||||
|
|
|
@ -194,6 +194,7 @@ struct PyBaz {
|
|||
}
|
||||
|
||||
#[derive(Debug, FromPyObject)]
|
||||
#[allow(dead_code)]
|
||||
struct Baz<U, T> {
|
||||
e: E<U, T>,
|
||||
tup: Tuple,
|
||||
|
|
Loading…
Reference in New Issue