diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-04-17 22:29:27 +0200 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-04-17 22:29:27 +0200 |
commit | 9ddf9bf087ec2f68e557db481ed551140db210bd (patch) | |
tree | 272f1f6ed0bd816d7b418c353fc267be4e2d8a80 | |
parent | 94c272ceaf57975dc6f2c43f35885c479d295677 (diff) |
use CamelCase for enum elements
-rw-r--r-- | src/actions/cursor.rs | 12 | ||||
-rw-r--r-- | src/actions/gen_completions.rs | 16 | ||||
-rw-r--r-- | src/actions/get.rs | 6 | ||||
-rw-r--r-- | src/testdata.rs | 2 | ||||
-rw-r--r-- | src/utils/dateutil.rs | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/actions/cursor.rs b/src/actions/cursor.rs index 59fd418..b15ffed 100644 --- a/src/actions/cursor.rs +++ b/src/actions/cursor.rs @@ -15,8 +15,8 @@ pub struct CursorArgs { arg_enum! { #[derive(Debug)] pub enum CursorDirection { - next, - prev, + Next, + Prev, } } @@ -32,8 +32,8 @@ pub fn do_cursor(args: &CursorArgs) -> KhResult<()> { //println!("stdin is tty") if let Some(direction) = &args.direction { match direction { - CursorDirection::prev => return cursor_sequence_move(&Direction::Up), - CursorDirection::next => return cursor_sequence_move(&Direction::Down), + CursorDirection::Prev => return cursor_sequence_move(&Direction::Up), + CursorDirection::Next => return cursor_sequence_move(&Direction::Down), } }; } @@ -110,7 +110,7 @@ mod integration { #[test] fn test_cursor_sequence_move_next() { let testdir = testutils::prepare_testdir("testdir_with_seq_and_cursor"); - let args = CursorArgs{direction: Some(CursorDirection::next)}; + let args = CursorArgs{direction: Some(CursorDirection::Next)}; do_cursor(&args).unwrap(); let out = "1182988800 rfc_multi_day_allday.ics"; @@ -121,7 +121,7 @@ mod integration { #[test] fn test_cursor_sequence_move_prev_at_end() { let testdir = testutils::prepare_testdir("testdir_with_seq_and_cursor"); - let args = CursorArgs{direction: Some(CursorDirection::prev)}; + let args = CursorArgs{direction: Some(CursorDirection::Prev)}; do_cursor(&args).unwrap(); let out = "1544740200 twodaysacrossbuckets.ics\n"; diff --git a/src/actions/gen_completions.rs b/src/actions/gen_completions.rs index b4c1946..e8e11ca 100644 --- a/src/actions/gen_completions.rs +++ b/src/actions/gen_completions.rs @@ -15,10 +15,10 @@ pub struct GenCompletionsArgs { arg_enum! { #[derive(Debug)] pub enum ShellArg{ - bash, - zsh, - fish, - elvish + Bash, + Zsh, + Fish, + Elvish } } @@ -26,10 +26,10 @@ pub fn gen_completions(args: &GenCompletionsArgs) -> KhResult<()> { let mut app = CommandLine::clap(); let binary_name = "khaleesi"; match args.shell { - ShellArg::bash => app.gen_completions_to(binary_name, Shell::Bash, &mut io::stdout()), - ShellArg::zsh => app.gen_completions_to(binary_name, Shell::Zsh, &mut io::stdout()), - ShellArg::fish => app.gen_completions_to(binary_name, Shell::Fish, &mut io::stdout()), - ShellArg::elvish => app.gen_completions_to(binary_name, Shell::Elvish, &mut io::stdout()), + ShellArg::Bash => app.gen_completions_to(binary_name, Shell::Bash, &mut io::stdout()), + ShellArg::Zsh => app.gen_completions_to(binary_name, Shell::Zsh, &mut io::stdout()), + ShellArg::Fish => app.gen_completions_to(binary_name, Shell::Fish, &mut io::stdout()), + ShellArg::Elvish => app.gen_completions_to(binary_name, Shell::Elvish, &mut io::stdout()), } Ok(()) } diff --git a/src/actions/get.rs b/src/actions/get.rs index 2b3b21f..513c0b3 100644 --- a/src/actions/get.rs +++ b/src/actions/get.rs @@ -12,13 +12,13 @@ pub struct GetArgs { arg_enum! { #[derive(Debug)] pub enum GetQueryArgs{ - calendars, + Calendars, } } pub fn action_get(args: &GetArgs) -> KhResult<()> { match args.query { - GetQueryArgs::calendars => action_get_calendars(), + GetQueryArgs::Calendars => action_get_calendars(), } } @@ -41,7 +41,7 @@ mod integration { fn test_get_calendars() { let _testdir = testutils::prepare_testdir("testdir_two_cals"); - let args = GetArgs { query: GetQueryArgs::calendars }; + let args = GetArgs { query: GetQueryArgs::Calendars }; action_get(&args).unwrap(); assert_eq!("first\nsecond\nsecond/second_sub\n", stdioutils::test_stdout_clear()); diff --git a/src/testdata.rs b/src/testdata.rs index 0fa9cd6..ba62f06 100644 --- a/src/testdata.rs +++ b/src/testdata.rs @@ -269,7 +269,7 @@ pub static TEST_EVENT_WITH_X_LIC_ERROR: &str = indoc!(" use chrono::{Utc,DateTime,TimeZone}; lazy_static! { - pub static ref now_test: DateTime<Utc> = Utc.ymd(2013, 01, 01).and_hms(1, 2, 3); + pub static ref NOW_TEST: DateTime<Utc> = Utc.ymd(2013, 01, 01).and_hms(1, 2, 3); } #[cfg(test)] diff --git a/src/utils/dateutil.rs b/src/utils/dateutil.rs index 981dd5a..2e5d372 100644 --- a/src/utils/dateutil.rs +++ b/src/utils/dateutil.rs @@ -55,7 +55,7 @@ pub fn now() -> DateTime<Utc> { #[cfg(test)] pub fn now() -> DateTime<Utc> { use crate::testdata; - *testdata::now_test + *testdata::NOW_TEST } pub fn week_from_str_end(date_str: &str) -> Result<Date<Local>,String> { |