Mercurial > hg
diff rust/hg-core/src/dirstate_tree/on_disk.rs @ 49930:e98fd81bb151
rust-clippy: fix most warnings in `hg-core`
All of these are simple changes that for the most part are clear improvements
and the rest are at most equivalent.
The remaining warnings have to be fixed either with a bigger refactor like for
the nested "revlog" module, or in the dependency `bytes-cast`, which we own.
This will be done sometime in the future.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 09 Jan 2023 19:18:43 +0100 |
parents | c7fb9b74e753 |
children | 95ffa065204e |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs Mon Jan 09 19:14:14 2023 +0100 +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Mon Jan 09 19:18:43 2023 +0100 @@ -246,11 +246,9 @@ pub fn parents(&self) -> DirstateParents { use crate::Node; let p1 = Node::try_from(&self.header.parent_1[..USED_NODE_ID_BYTES]) - .unwrap() - .clone(); + .unwrap(); let p2 = Node::try_from(&self.header.parent_2[..USED_NODE_ID_BYTES]) - .unwrap() - .clone(); + .unwrap(); DirstateParents { p1, p2 } } @@ -322,7 +320,7 @@ read_hg_path(on_disk, self.full_path) } - pub(super) fn base_name_start<'on_disk>( + pub(super) fn base_name_start( &self, ) -> Result<usize, DirstateV2ParseError> { let start = self.base_name_start.get(); @@ -355,7 +353,7 @@ )) } - pub(super) fn has_copy_source<'on_disk>(&self) -> bool { + pub(super) fn has_copy_source(&self) -> bool { self.copy_source.start.get() != 0 } @@ -414,12 +412,12 @@ } else { libc::S_IFREG }; - let permisions = if self.flags().contains(Flags::MODE_EXEC_PERM) { + let permissions = if self.flags().contains(Flags::MODE_EXEC_PERM) { 0o755 } else { 0o644 }; - (file_type | permisions).into() + file_type | permissions } fn mtime(&self) -> Result<TruncatedTimestamp, DirstateV2ParseError> {