Mercurial > hg
comparison rust/hg-cpython/src/dirstate/copymap.rs @ 44973:26114bd6ec60
rust: do a clippy pass
This is the result of running `cargo clippy` on hg-core/hg-cpython and fixing
the lints that do not require too much code churn (and would warrant a separate
commit/complete refactor) and only come from our code (a lot of warnings in
hg-cpython come from `rust-cpython`).
Most of those were good lints, two of them was the linter not being smart
enough (or compiler to get up to `clippy`'s level depending on how you see it).
Maybe in the future we could have `clippy` be part of the CI.
Differential Revision: https://phab.mercurial-scm.org/D8635
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 15 Jun 2020 18:26:40 +0200 |
parents | bad4e7b361d2 |
children | cd8ca38fccff |
comparison
equal
deleted
inserted
replaced
44962:ef8dcee272ac | 44973:26114bd6ec60 |
---|---|
87 } | 87 } |
88 fn translate_key( | 88 fn translate_key( |
89 py: Python, | 89 py: Python, |
90 res: (&HgPathBuf, &HgPathBuf), | 90 res: (&HgPathBuf, &HgPathBuf), |
91 ) -> PyResult<Option<PyBytes>> { | 91 ) -> PyResult<Option<PyBytes>> { |
92 Ok(Some(PyBytes::new(py, res.0.as_ref()))) | 92 Ok(Some(PyBytes::new(py, res.0.as_bytes()))) |
93 } | 93 } |
94 fn translate_key_value( | 94 fn translate_key_value( |
95 py: Python, | 95 py: Python, |
96 res: (&HgPathBuf, &HgPathBuf), | 96 res: (&HgPathBuf, &HgPathBuf), |
97 ) -> PyResult<Option<(PyBytes, PyBytes)>> { | 97 ) -> PyResult<Option<(PyBytes, PyBytes)>> { |
98 let (k, v) = res; | 98 let (k, v) = res; |
99 Ok(Some(( | 99 Ok(Some(( |
100 PyBytes::new(py, k.as_ref()), | 100 PyBytes::new(py, k.as_bytes()), |
101 PyBytes::new(py, v.as_ref()), | 101 PyBytes::new(py, v.as_bytes()), |
102 ))) | 102 ))) |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 py_shared_iterator!( | 106 py_shared_iterator!( |