diff rust/hg-cpython/src/parsers.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 5ac243a92e37
children 27424779c5b8
line wrap: on
line diff
--- a/rust/hg-cpython/src/parsers.rs	Mon Jun 15 15:14:16 2020 -0400
+++ b/rust/hg-cpython/src/parsers.rs	Mon Jun 15 18:26:40 2020 +0200
@@ -37,15 +37,15 @@
             for (filename, entry) in &dirstate_map {
                 dmap.set_item(
                     py,
-                    PyBytes::new(py, filename.as_ref()),
+                    PyBytes::new(py, filename.as_bytes()),
                     make_dirstate_tuple(py, entry)?,
                 )?;
             }
             for (path, copy_path) in copies {
                 copymap.set_item(
                     py,
-                    PyBytes::new(py, path.as_ref()),
-                    PyBytes::new(py, copy_path.as_ref()),
+                    PyBytes::new(py, path.as_bytes()),
+                    PyBytes::new(py, copy_path.as_bytes()),
                 )?;
             }
             Ok(
@@ -116,7 +116,7 @@
             for (filename, entry) in &dirstate_map {
                 dmap.set_item(
                     py,
-                    PyBytes::new(py, filename.as_ref()),
+                    PyBytes::new(py, filename.as_bytes()),
                     make_dirstate_tuple(py, entry)?,
                 )?;
             }