Mercurial > hg
comparison rust/hg-core/src/dirstate_tree/on_disk.rs @ 51119:d58e754f2db0
rust-clippy: ignore clippy's recommendation for "useless" cast
See explanation inline.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 06 Nov 2023 11:02:18 +0100 |
parents | 0cc19a53cef4 |
children | 9dbbaecfc950 |
comparison
equal
deleted
inserted
replaced
51118:98910135a3bc | 51119:d58e754f2db0 |
---|---|
412 Ok(None) | 412 Ok(None) |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 fn synthesize_unix_mode(&self) -> u32 { | 416 fn synthesize_unix_mode(&self) -> u32 { |
417 // Some platforms' libc don't have the same type (MacOS uses i32 here) | |
418 #[allow(clippy::unnecessary_cast)] | |
417 let file_type = if self.flags().contains(Flags::MODE_IS_SYMLINK) { | 419 let file_type = if self.flags().contains(Flags::MODE_IS_SYMLINK) { |
418 libc::S_IFLNK as u32 | 420 libc::S_IFLNK as u32 |
419 } else { | 421 } else { |
420 libc::S_IFREG as u32 | 422 libc::S_IFREG as u32 |
421 }; | 423 }; |
527 // TODO: convert through raw flag bits instead? | 529 // TODO: convert through raw flag bits instead? |
528 let mut flags = Flags::empty(); | 530 let mut flags = Flags::empty(); |
529 flags.set(Flags::WDIR_TRACKED, wc_tracked); | 531 flags.set(Flags::WDIR_TRACKED, wc_tracked); |
530 flags.set(Flags::P1_TRACKED, p1_tracked); | 532 flags.set(Flags::P1_TRACKED, p1_tracked); |
531 flags.set(Flags::P2_INFO, p2_info); | 533 flags.set(Flags::P2_INFO, p2_info); |
534 // Some platforms' libc don't have the same type (MacOS uses i32 here) | |
535 #[allow(clippy::unnecessary_cast)] | |
532 let size = if let Some((m, s)) = mode_size_opt { | 536 let size = if let Some((m, s)) = mode_size_opt { |
533 let exec_perm = m & (libc::S_IXUSR as u32) != 0; | 537 let exec_perm = m & (libc::S_IXUSR as u32) != 0; |
534 let is_symlink = m & (libc::S_IFMT as u32) == libc::S_IFLNK as u32; | 538 let is_symlink = m & (libc::S_IFMT as u32) == libc::S_IFLNK as u32; |
535 flags.set(Flags::MODE_EXEC_PERM, exec_perm); | 539 flags.set(Flags::MODE_EXEC_PERM, exec_perm); |
536 flags.set(Flags::MODE_IS_SYMLINK, is_symlink); | 540 flags.set(Flags::MODE_IS_SYMLINK, is_symlink); |