Skip to content

Commit

Permalink
Fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelmello committed Sep 29, 2024
1 parent 080b115 commit 446ce3d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
1 change: 1 addition & 0 deletions inquire/src/ansi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ impl<'a> Iterator for AnsiStrippedChars<'a> {

/// Constructs an iterator over the chars of the input string, stripping away ANSI escape codes.
pub trait AnsiStrippable {
#[allow(unused)]
fn ansi_stripped_chars(&self) -> AnsiStrippedChars<'_>;
}

Expand Down
12 changes: 6 additions & 6 deletions inquire/src/date_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn get_current_date() -> NaiveDate {
}

pub fn get_start_date(month: chrono::Month, year: i32) -> NaiveDate {
chrono::NaiveDate::from_ymd_opt(year, month.number_from_month(), 1).unwrap()
NaiveDate::from_ymd_opt(year, month.number_from_month(), 1).unwrap()
}

pub fn get_month(month: u32) -> chrono::Month {
Expand Down Expand Up @@ -43,23 +43,23 @@ mod tests {
fn test_get_start_date() {
assert_eq!(
get_start_date(chrono::Month::January, 2021),
chrono::NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()
NaiveDate::from_ymd_opt(2021, 1, 1).unwrap()
);
assert_eq!(
get_start_date(chrono::Month::February, 2021),
chrono::NaiveDate::from_ymd_opt(2021, 2, 1).unwrap()
NaiveDate::from_ymd_opt(2021, 2, 1).unwrap()
);
assert_eq!(
get_start_date(chrono::Month::March, 2021),
chrono::NaiveDate::from_ymd_opt(2021, 3, 1).unwrap()
NaiveDate::from_ymd_opt(2021, 3, 1).unwrap()
);
assert_eq!(
get_start_date(chrono::Month::December, 1883),
chrono::NaiveDate::from_ymd_opt(1883, 12, 1).unwrap()
NaiveDate::from_ymd_opt(1883, 12, 1).unwrap()
);
assert_eq!(
get_start_date(chrono::Month::June, 3042),
chrono::NaiveDate::from_ymd_opt(3042, 6, 1).unwrap()
NaiveDate::from_ymd_opt(3042, 6, 1).unwrap()
);
}

Expand Down
28 changes: 14 additions & 14 deletions inquire/src/prompts/one_liners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ where
/// # Returns
///
/// * `InquireResult<NaiveDate>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(NaiveDate)` where NaiveDate's value is the date selected by the user. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(NaiveDate)` where NaiveDate's value is the date selected by the user. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -158,8 +158,8 @@ where
/// # Returns
///
/// * `InquireResult<f64>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(f64)` where f64 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(f64)` where f64 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -193,8 +193,8 @@ where
/// # Returns
///
/// * `InquireResult<f32>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(f32)` where f32 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(f32)` where f32 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -228,8 +228,8 @@ where
/// # Returns
///
/// * `InquireResult<u64>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(u64)` where u64 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(u64)` where u64 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -263,8 +263,8 @@ where
/// # Returns
///
/// * `InquireResult<u32>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(u32)` where u32 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(u32)` where u32 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -298,8 +298,8 @@ where
/// # Returns
///
/// * `InquireResult<usize>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(usize)` where usize is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(usize)` where usize is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down Expand Up @@ -333,8 +333,8 @@ where
/// # Returns
///
/// * `InquireResult<u128>`: An enum that represents the result of the prompt operation. If the operation is successful,
/// it returns `InquireResult::Ok(u128)` where u128 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
/// it returns `InquireResult::Ok(u128)` where u128 is the number parsed from the user's input. If the operation
/// encounters an error, it returns `InquireResult::Err(InquireError)`.
///
/// # Example
///
Expand Down
2 changes: 1 addition & 1 deletion inquire/src/terminal/crossterm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl InputReader for CrosstermKeyReader {

impl CrosstermTerminal {
pub fn new() -> InquireResult<Self> {
crossterm::terminal::enable_raw_mode()?;
terminal::enable_raw_mode()?;

Ok(Self {
io: IO::Std(stderr()),
Expand Down
1 change: 1 addition & 0 deletions inquire/src/terminal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub trait Terminal: Sized {
fn cursor_down(&mut self, cnt: u16) -> Result<()>;
fn cursor_left(&mut self, cnt: u16) -> Result<()>;
fn cursor_right(&mut self, cnt: u16) -> Result<()>;
#[allow(unused)]
fn cursor_move_to_column(&mut self, idx: u16) -> Result<()>;

fn flush(&mut self) -> Result<()>;
Expand Down
4 changes: 2 additions & 2 deletions inquire/src/terminal/termion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ impl<'a> Terminal for TermionTerminal<'a> {
}

fn cursor_hide(&mut self) -> Result<()> {
write!(self.get_writer(), "{}", termion::cursor::Hide)
write!(self.get_writer(), "{}", cursor::Hide)
}

fn cursor_show(&mut self) -> Result<()> {
write!(self.get_writer(), "{}", termion::cursor::Show)
write!(self.get_writer(), "{}", cursor::Show)
}
}

Expand Down

0 comments on commit 446ce3d

Please sign in to comment.