From f8da5ab2e76503e1f94b79dc0f6b21f00005e3a3 Mon Sep 17 00:00:00 2001 From: Joseph T Lyons Date: Wed, 28 Sep 2022 17:07:11 -0400 Subject: [PATCH] Remove "get" prefix from function names --- crates/journal/src/journal.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 3a44345b70..c6e33d1134 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -14,7 +14,7 @@ pub fn init(app_state: Arc, cx: &mut MutableAppContext) { pub fn new_journal_entry(app_state: Arc, cx: &mut MutableAppContext) { let settings = cx.global::(); - let journal_dir = match get_journal_dir(&settings.journal_overrides.journal_directory) { + let journal_dir = match journal_dir(&settings.journal_overrides.journal_directory) { Some(journal_dir) => journal_dir, None => { log::error!("can't determine home directory"); @@ -29,7 +29,7 @@ pub fn new_journal_entry(app_state: Arc, cx: &mut MutableAppContext) { let entry_path = month_dir.join(format!("{:02}.md", now.day())); let now = now.time(); let hour_format = &settings.journal_overrides.hour_format; - let entry_heading = get_heading_entry(now, &hour_format); + let entry_heading = heading_entry(now, &hour_format); let create_entry = cx.background().spawn(async move { std::fs::create_dir_all(month_dir)?; @@ -76,7 +76,7 @@ pub fn new_journal_entry(app_state: Arc, cx: &mut MutableAppContext) { .detach(); } -fn get_journal_dir(a: &Option) -> Option { +fn journal_dir(a: &Option) -> Option { let journal_default_dir = dirs::home_dir()?.join("journal"); let journal_dir = match a { @@ -89,7 +89,7 @@ fn get_journal_dir(a: &Option) -> Option { Some(journal_dir) } -fn get_heading_entry(now: NaiveTime, hour_format: &Option) -> String { +fn heading_entry(now: NaiveTime, hour_format: &Option) -> String { match hour_format { Some(HourFormat::Hour24) => { let hour = now.hour(); @@ -111,7 +111,7 @@ mod tests { #[test] fn test_heading_entry_defaults_to_hour_12() { let naive_time = NaiveTime::from_hms_milli(15, 0, 0, 0); - let actual_heading_entry = get_heading_entry(naive_time, &None); + let actual_heading_entry = heading_entry(naive_time, &None); let expected_heading_entry = "# 3:00 PM"; assert_eq!(actual_heading_entry, expected_heading_entry); @@ -120,7 +120,7 @@ mod tests { #[test] fn test_heading_entry_is_hour_12() { let naive_time = NaiveTime::from_hms_milli(15, 0, 0, 0); - let actual_heading_entry = get_heading_entry(naive_time, &Some(HourFormat::Hour12)); + let actual_heading_entry = heading_entry(naive_time, &Some(HourFormat::Hour12)); let expected_heading_entry = "# 3:00 PM"; assert_eq!(actual_heading_entry, expected_heading_entry); @@ -129,7 +129,7 @@ mod tests { #[test] fn test_heading_entry_is_hour_24() { let naive_time = NaiveTime::from_hms_milli(15, 0, 0, 0); - let actual_heading_entry = get_heading_entry(naive_time, &Some(HourFormat::Hour24)); + let actual_heading_entry = heading_entry(naive_time, &Some(HourFormat::Hour24)); let expected_heading_entry = "# 15:00"; assert_eq!(actual_heading_entry, expected_heading_entry);