Skip to content

Commit

Permalink
Fix clippy warnings in build.rs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Feb 10, 2020
1 parent 3176097 commit 2c6dc94
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,14 @@ fn get_config_vars(python_path: &str) -> Result<HashMap<String, String>, String>
));
}
let all_vars = SYSCONFIG_FLAGS.iter().chain(SYSCONFIG_VALUES.iter());
let all_vars = all_vars.zip(split_stdout.iter()).fold(
HashMap::new(),
|mut memo: HashMap<String, String>, (&k, &v)| {
if !(v.to_owned() == "None" && is_value(k)) {
memo.insert(k.to_owned(), v.to_owned());
let all_vars = all_vars
.zip(split_stdout.iter())
.fold(HashMap::new(), |mut memo, (&k, &v)| {
if !(v == "None" && is_value(k)) {
memo.insert(k.to_string(), v.to_string());
}
memo
},
);
});

Ok(fix_config_map(all_vars))
}
Expand Down
2 changes: 1 addition & 1 deletion guide/src/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn rust2py(py: Python, m: &PyModule) -> PyResult<()> {

// logic implemented as a normal rust function
fn sum_as_string(a:i64, b:i64) -> String {
format!("{}", a + b).to_string()
format!("{}", a + b)
}

# fn main() {}
Expand Down
2 changes: 1 addition & 1 deletion pyo3-derive-backend/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ fn impl_class(

// Enforce at compile time that PyGCProtocol is implemented
let gc_impl = if has_gc {
let closure_name = format!("__assertion_closure_{}", cls.to_string());
let closure_name = format!("__assertion_closure_{}", cls);
let closure_token = syn::Ident::new(&closure_name, Span::call_site());
quote! {
fn #closure_token() {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct AnonClass {}
struct LocatedClass {}

fn sum_as_string(a: i64, b: i64) -> String {
format!("{}", a + b).to_string()
format!("{}", a + b)
}

#[pyfunction]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pyself.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl PyIterProtocol for Iter {
fn reader() -> Reader {
let reader = [(1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e")];
Reader {
inner: reader.iter().map(|(k, v)| (*k, v.to_string())).collect(),
inner: reader.iter().map(|(k, v)| (*k, (*v).to_string())).collect(),
}
}

Expand Down

0 comments on commit 2c6dc94

Please sign in to comment.