Convert from bool to u8 using From trait

This commit is contained in:
Victor Song 2022-09-30 23:10:57 -04:00
parent 7595289698
commit 19601267cf

View File

@ -6,7 +6,7 @@ use crate::output::cell::TextCell;
impl f::OctalPermissions { impl f::OctalPermissions {
fn bits_to_octal(r: bool, w: bool, x: bool) -> u8 { fn bits_to_octal(r: bool, w: bool, x: bool) -> u8 {
(r as u8) * 4 + (w as u8) * 2 + (x as u8) u8::from(r) * 4 + u8::from(w) * 2 + u8::from(x)
} }
pub fn render(&self, style: Style) -> TextCell { pub fn render(&self, style: Style) -> TextCell {