Fix some clippy and dead code warnings.

This commit is contained in:
Georg Brandl 2021-11-24 08:59:22 +01:00
parent f5f47bebcb
commit 9990bf9d31
5 changed files with 5 additions and 8 deletions

View File

@ -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()],

View File

@ -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)
}

View File

@ -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);
}

View File

@ -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.

View File

@ -194,6 +194,7 @@ struct PyBaz {
}
#[derive(Debug, FromPyObject)]
#[allow(dead_code)]
struct Baz<U, T> {
e: E<U, T>,
tup: Tuple,