Use bitflags contains() instead of intersects()

`intersects()` is "any of" while `contains()` is "all of" and while it makes no
difference when testing a single bit, I believe `contains()` is less brittle
for future maintenance and updates as its meaning is clearer.

</pedantic>
This commit is contained in:
Mahmoud Al-Qudsi 2024-03-23 00:24:31 -05:00
parent 6ed4d09c93
commit 6f9f9ee400
2 changed files with 2 additions and 2 deletions

View File

@ -447,7 +447,7 @@ impl EnvUniversal {
Err(nix::Error::EINTR) => continue, Err(nix::Error::EINTR) => continue,
Err(err) => { Err(err) => {
if !O_EXLOCK.is_empty() { if !O_EXLOCK.is_empty() {
if flags.intersects(O_EXLOCK) if flags.contains(O_EXLOCK)
&& [nix::Error::ENOTSUP, nix::Error::EOPNOTSUPP].contains(&err) && [nix::Error::ENOTSUP, nix::Error::EOPNOTSUPP].contains(&err)
{ {
// Filesystem probably does not support locking. Give up on locking. // Filesystem probably does not support locking. Give up on locking.

View File

@ -669,7 +669,7 @@ impl IoChain {
self.push(Arc::new(IoFile::new(spec.fd, fd))); self.push(Arc::new(IoFile::new(spec.fd, fd)));
} }
Err(err) => { Err(err) => {
if oflags.intersects(OFlag::O_EXCL) && err == nix::Error::EEXIST { if oflags.contains(OFlag::O_EXCL) && err == nix::Error::EEXIST {
FLOGF!(warning, NOCLOB_ERROR, spec.target); FLOGF!(warning, NOCLOB_ERROR, spec.target);
} else { } else {
if should_flog!(warning) { if should_flog!(warning) {