Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/status.rs @ 52061:0ea323b7e3b1
rust-manifest: encode flags as `Option<NonZeroU8>`
This makes the compiler use the niche optimization for all flags: since 0 is
not a valid representation of any flags, we can use 0 as a replacement for
`None`, which reduces memory footprint and could yield a little performance
improvement over many iterations.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 30 Sep 2024 12:08:49 +0200 |
parents | db7dbe6f7bb2 |
children | f204583a24ca 039b7caeb4d9 |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Mon Sep 30 17:46:52 2024 +0200 +++ b/rust/rhg/src/commands/status.rs Mon Sep 30 12:08:49 2024 +0200 @@ -776,13 +776,13 @@ let entry_flags = if check_exec { entry.flags - } else if entry.flags == Some(b'x') { + } else if entry.flags.map(|f| f.into()) == Some(b'x') { None } else { entry.flags }; - if entry_flags != fs_flags { + if entry_flags.map(|f| f.into()) != fs_flags { return Ok(UnsureOutcome::Modified); } let filelog = hg::filelog::Filelog::open_vfs(