refactor: minimize visibility of functions

This commit is contained in:
Narawit Rakket 2022-08-12 22:47:26 +07:00 committed by Abin Simon
parent 08626b84fc
commit 0a7e6e7f47
5 changed files with 11 additions and 11 deletions

View file

@ -67,11 +67,11 @@ pub enum Elem {
}
impl Elem {
pub fn has_suid(&self) -> bool {
fn has_suid(&self) -> bool {
matches!(self, Elem::Dir { uid: true } | Elem::File { uid: true, .. })
}
pub fn get_color(&self, theme: &theme::Theme) -> Color {
fn get_color(&self, theme: &theme::Theme) -> Color {
match self {
Elem::File {
exec: true,

View file

@ -41,7 +41,7 @@ impl Date {
colors.colorize(self.date_string(flags), &elem)
}
pub fn date_string(&self, flags: &Flags) -> String {
fn date_string(&self, flags: &Flags) -> String {
if let Date::Date(val) = self {
match &flags.date {
DateFlag::Date => val.format("%c").to_string(),

View file

@ -78,7 +78,7 @@ impl Name {
.collect()
}
pub fn escape(&self, string: &str) -> String {
fn escape(&self, string: &str) -> String {
if string
.chars()
.all(|c| c >= 0x20 as char && c != 0x7f as char)

View file

@ -169,7 +169,7 @@ mod test {
use tempfile::tempdir;
#[test]
pub fn permission_rwx() {
fn permission_rwx() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;
@ -189,7 +189,7 @@ mod test {
}
#[test]
pub fn permission_rwx2() {
fn permission_rwx2() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;
@ -209,7 +209,7 @@ mod test {
}
#[test]
pub fn permission_rwx_sticky() {
fn permission_rwx_sticky() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;
@ -231,7 +231,7 @@ mod test {
}
#[test]
pub fn permission_octal() {
fn permission_octal() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;
@ -252,7 +252,7 @@ mod test {
}
#[test]
pub fn permission_octal2() {
fn permission_octal2() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;
@ -273,7 +273,7 @@ mod test {
}
#[test]
pub fn permission_octal_sticky() {
fn permission_octal_sticky() {
let tmp_dir = tempdir().expect("failed to create temp dir");
// Create the file;

View file

@ -40,7 +40,7 @@ impl Size {
format!("{0:.1$}", number, if number < 10.0 { 1 } else { 0 })
}
pub fn get_unit(&self, flags: &Flags) -> Unit {
fn get_unit(&self, flags: &Flags) -> Unit {
if flags.size == SizeFlag::Bytes {
return Unit::Byte;
}