diff options
author | Tim Oram <dev@mitmaro.ca> | 2024-02-11 11:15:31 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2024-02-15 20:27:06 -0330 |
commit | 4a5dc5b3e9ef633ca0b7cd82a653a346c7521b8a (patch) | |
tree | 46e7af8a1f86e7ec32f2eee588448629df14d887 | |
parent | 892d974ad159db33accdea20757299e9a0666cd2 (diff) |
Strip inline attributes
70 files changed, 1 insertions, 466 deletions
diff --git a/src/config.rs b/src/config.rs index ab628fe..de8c988 100644 --- a/src/config.rs +++ b/src/config.rs @@ -71,7 +71,6 @@ pub(crate) struct Config { impl Config { /// Create a new configuration with default values. - #[inline] #[must_use] #[allow(clippy::missing_panics_doc)] pub(crate) fn new() -> Self { @@ -114,7 +113,6 @@ impl TryFrom<&Repository> for Config { /// # Errors /// /// Will return an `Err` if there is a problem loading the configuration. - #[inline] fn try_from(repo: &Repository) -> Result<Self, Self::Error> { let config = repo .load_config() @@ -126,7 +124,6 @@ impl TryFrom<&Repository> for Config { impl TryFrom<&crate::git::Config> for Config { type Error = ConfigError; - #[inline] fn try_from(config: &crate::git::Config) -> Result<Self, Self::Error> { Self::new_with_config(Some(config)) } diff --git a/src/config/color.rs b/src/config/color.rs index 6e7921d..fe682d6 100644 --- a/src/config/color.rs +++ b/src/config/color.rs @@ -59,7 +59,6 @@ impl TryFrom<&str> for Color { type Error = InvalidColorError; #[allow(clippy::unwrap_in_result)] - #[inline] fn try_from(s: &str) -> Result<Self, Self::Error> { match s { "black" | "light black" => Ok(Self::LightBlack), diff --git a/src/config/errors.rs b/src/config/errors.rs index 899fa42..a3aedb6 100644 --- a/src/config/errors.rs +++ b/src/config/errors.rs @@ -50,7 +50,6 @@ impl ConfigError { } impl Display for ConfigError { - #[inline] fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { if let Some(input) = self.input.as_deref() { write!( diff --git a/src/config/git_config.rs b/src/config/git_config.rs index 3d94062..a928b71 100644 --- a/src/config/git_config.rs +++ b/src/config/git_config.rs @@ -51,7 +51,6 @@ pub(crate) struct GitConfig { impl GitConfig { /// Create a new configuration with default values. - #[inline] #[must_use] #[allow(clippy::missing_panics_doc)] pub(crate) fn new() -> Self { @@ -81,7 +80,6 @@ impl GitConfig { impl TryFrom<&Config> for GitConfig { type Error = ConfigError; - #[inline] fn try_from(config: &Config) -> Result<Self, Self::Error> { Self::new_with_config(Some(config)) } diff --git a/src/config/key_bindings.rs b/src/config/key_bindings.rs index b0f1a02..f60b580 100644 --- a/src/config/key_bindings.rs +++ b/src/config/key_bindings.rs @@ -116,7 +116,6 @@ pub(crate) struct KeyBindings { impl KeyBindings { /// Create a new configuration with default values. #[must_use] - #[inline] #[allow(clippy::missing_panics_doc)] pub(crate) fn new() -> Self { Self::new_with_config(None).unwrap() // should never error with None config @@ -189,7 +188,6 @@ impl KeyBindings { impl TryFrom<&Config> for KeyBindings { type Error = ConfigError; - #[inline] fn try_from(config: &Config) -> Result<Self, Self::Error> { Self::new_with_config(Some(config)) } diff --git a/src/config/theme.rs b/src/config/theme.rs index 7ab451d..ec6ccd4 100644 --- a/src/config/theme.rs +++ b/src/config/theme.rs @@ -76,7 +76,6 @@ pub(crate) struct Theme { impl Theme { /// Create a new configuration with default values. #[must_use] - #[inline] #[allow(clippy::missing_panics_doc)] pub(crate) fn new() -> Self { Self::new_with_config(None).unwrap() // should never error with None config @@ -134,7 +133,6 @@ impl Theme { impl TryFrom<&Config> for Theme { type Error = ConfigError; - #[inline] fn try_from(config: &Config) -> Result<Self, Self::Error> { Self::new_with_config(Some(config)) } diff --git a/src/display.rs b/src/display.rs index ccf954f..b80da19 100644 --- a/src/display.rs +++ b/src/display.rs @@ -59,7 +59,6 @@ pub(crate) struct Display<T: Tui> { impl<T: Tui> Display<T> { /// Create a new display instance. - #[inline] pub(crate) fn new(tui: T, theme: &Theme) -> Self { let color_mode = tui.get_color_mode(); let normal = register_selectable_color_pairs( @@ -205,7 +204,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn draw_str(&mut self, s: &str) -> Result<(), DisplayError> { self.tui.print(s) } @@ -214,7 +212,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn clear(&mut self) -> Result<(), DisplayError> { self.color(DisplayColor::Normal, false)?; self.set_style(false, false, false)?; @@ -227,7 +224,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn refresh(&mut self) -> Result<(), DisplayError> { self.tui.flush() } @@ -237,7 +233,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn color(&mut self, color: DisplayColor, selected: bool) -> Result<(), DisplayError> { self.tui.set_color( if selected { @@ -294,7 +289,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn set_style(&mut self, dim: bool, underline: bool, reverse: bool) -> Result<(), DisplayError> { self.set_dim(dim)?; self.set_underline(underline)?; @@ -306,7 +300,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn get_window_size(&self) -> Size { self.tui.get_size() } @@ -315,7 +308,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn ensure_at_line_start(&mut self) -> Result<(), DisplayError> { self.tui.move_to_column(0) } @@ -324,7 +316,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn move_from_end_of_line(&mut self, right: u16) -> Result<(), DisplayError> { let width = self.get_window_size().width().try_into().unwrap_or(u16::MAX); self.tui.move_to_column(width - right) @@ -334,7 +325,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn next_line(&mut self) -> Result<(), DisplayError> { self.tui.move_next_line() } @@ -344,7 +334,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn start(&mut self) -> Result<(), DisplayError> { self.tui.start()?; self.tui.flush() @@ -356,7 +345,6 @@ impl<T: Tui> Display<T> { /// /// # Errors /// Will error if the underlying terminal interface is in an error state. - #[inline] pub(crate) fn end(&mut self) -> Result<(), DisplayError> { self.tui.end()?; self.tui.flush() diff --git a/src/display/color_mode.rs b/src/display/color_mode.rs index 5ac4596..727e4eb 100644 --- a/src/display/color_mode.rs +++ b/src/display/color_mode.rs @@ -16,14 +16,12 @@ pub(crate) enum ColorMode { impl ColorMode { /// Supports 4 bit or more of color. - #[inline] #[must_use] pub(crate) fn has_minimum_four_bit_color(self) -> bool { self == Self::FourBit || self == Self::EightBit || self == Self::TrueColor } /// Has true color support. - #[inline] #[must_use] pub(crate) fn has_true_color(self) -> bool { self == Self::TrueColor diff --git a/src/display/crossterm.rs b/src/display/crossterm.rs index 0a699ee..da2da8e 100644 --- a/src/display/crossterm.rs +++ b/src/display/crossterm.rs @@ -35,12 +35,10 @@ pub(crate) struct CrossTerm { } impl Tui for CrossTerm { - #[inline] fn get_color_mode(&self) -> ColorMode { self.color_mode } - #[inline] fn reset(&mut self) -> Result<(), DisplayError> { self.queue_command(ResetColor)?; self.queue_command(SetAttribute(Attribute::Reset))?; @@ -48,22 +46,18 @@ impl Tui for CrossTerm { self.queue_command(MoveTo(0, 0)) } - #[inline] fn flush(&mut self) -> Result<(), DisplayError> { self.window.flush().map_err(DisplayError::Unexpected) } - #[inline] fn print(&mut self, s: &str) -> Result<(), DisplayError> { self.queue_command(Print(s)) } - #[inline] fn set_color(&mut self, colors: Colors) -> Result<(), DisplayError> { self.queue_command(SetColors(colors)) } - #[inline] fn set_dim(&mut self, dim: bool) -> Result<(), DisplayError> { self.queue_command(SetAttribute( if dim { @@ -75,7 +69,6 @@ impl Tui for CrossTerm { )) } - #[inline] fn set_underline(&mut self, underline: bool) -> Result<(), DisplayError> { self.queue_command(SetAttribute( if underline { @@ -87,7 +80,6 @@ impl Tui for CrossTerm { )) } - #[inline] fn set_reverse(&mut self, reverse: bool) -> Result<(), DisplayError> { self.queue_command(SetAttribute( if reverse { @@ -99,7 +91,6 @@ impl Tui for CrossTerm { )) } - #[inline] fn get_size(&self) -> Size { size().map_or_else( |_| Size::new(0, 0), @@ -107,17 +98,14 @@ impl Tui for CrossTerm { ) } - #[inline] fn move_to_column(&mut self, x: u16) -> Result<(), DisplayError> { self.queue_command(MoveToColumn(x)) } - #[inline] fn move_next_line(&mut self) -> Result<(), DisplayError> { self.queue_command(MoveToNextLine(1)) } - #[inline] fn start(&mut self) -> Result<(), DisplayError> { self.queue_command(EnterAlternateScreen)?; self.queue_command(DisableLineWrap)?; @@ -134,7 +122,6 @@ impl Tui for CrossTerm { self.flush() } - #[inline] fn end(&mut self) -> Result<(), DisplayError> { // this will fail on terminals without support, so ignore any errors let _command_result = self.queue_command(PopKeyboardEnhancementFlags); @@ -149,7 +136,6 @@ impl Tui for CrossTerm { impl CrossTerm { /// Create a new instance. - #[inline] #[must_use] pub(crate) fn new() -> Self { Self { diff --git a/src/display/error.rs b/src/display/error.rs index 83605cc..412b4ab 100644 --- a/src/display/error.rs +++ b/src/display/error.rs @@ -12,7 +12,6 @@ pub(crate) enum DisplayError { } impl PartialEq for DisplayError { - #[inline] #[allow(clippy::pattern_type_mismatch)] fn eq(&self, other: &Self) -> bool { match (self, other) { diff --git a/src/display/size.rs b/src/display/size.rs index 085c9f4..3c4652a 100644 --- a/src/display/size.rs +++ b/src/display/size.rs @@ -7,21 +7,18 @@ pub(crate) struct Size { impl Size { /// Create a new instance with a width and height. - #[inline] #[must_use] pub(crate) const fn new(width: usize, height: usize) -> Self { Self { width, height } } /// Get the width. - #[inline] #[must_use] pub(crate) const fn width(&self) -> usize { self.width } /// Get the height. - #[inline] #[must_use] pub(crate) const fn height(&self) -> usize { self.height diff --git a/src/display/testutil.rs b/src/display/testutil.rs index aca2edf..2c986dd 100644 --- a/src/display/testutil.rs +++ b/src/display/testutil.rs @@ -15,7 +15,6 @@ use crate::display::Display; /// # Panics /// /// Will panic is the expected output does not match the rendered output. -#[inline] #[allow(clippy::missing_assert_message)] // not sure why this is triggering pub(crate) fn assert_output(display: &Display<CrossTerm>, expected: &[&str]) { assert_eq!(display.tui.get_output().join(""), format!("{}\n", expected.join("\n"))); diff --git a/src/display/testutil/mockable_tui.rs b/src/display/testutil/mockable_tui.rs index 57496f1..906d930 100644 --- a/src/display/testutil/mockable_tui.rs +++ b/src/display/testutil/mockable_tui.rs @@ -6,7 +6,6 @@ use crate::display::{ColorMode, DisplayError, Size, Tui}; /// Create an instance of a `DisplayError::Unexpected` error with an other IO error. #[must_use] -#[inline] pub(crate) fn create_unexpected_error() -> DisplayError { DisplayError::Unexpected(io::Error::from(io::ErrorKind::Other)) } @@ -16,134 +15,108 @@ pub(crate) fn create_unexpected_error() -> DisplayError { /// interface. #[allow(missing_docs, clippy::missing_errors_doc)] pub(crate) trait MockableTui: Tui { - #[inline] fn get_color_mode(&self) -> ColorMode { ColorMode::TwoTone } - #[inline] fn reset(&mut self) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn flush(&mut self) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn print(&mut self, _s: &str) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn set_color(&mut self, _colors: Colors) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn set_dim(&mut self, _dim: bool) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn set_underline(&mut self, _underline: bool) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn set_reverse(&mut self, _reverse: bool) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn get_size(&self) -> Size { Size::new(100, 100) } - #[inline] fn move_to_column(&mut self, _x: u16) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn move_next_line(&mut self) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn start(&mut self) -> Result<(), DisplayError> { Ok(()) } - #[inline] fn end(&mut self) -> Result<(), DisplayError> { Ok(()) } } impl<T: MockableTui> Tui for T { - #[inline] fn get_color_mode(&self) -> ColorMode { <T as MockableTui>::get_color_mode(self) } - #[inline] fn reset(&mut self) -> Result<(), DisplayError> { <T as MockableTui>::reset(self) } - #[inline] fn flush(&mut self) -> Result<(), DisplayError> { <T as MockableTui>::flush(self) } - #[inline] fn print(&mut self, s: &str) -> Result<(), DisplayError> { <T as MockableTui>::print(self, s) } - #[inline] fn set_color(&mut self, colors: Colors) -> Result<(), DisplayError> { <T as MockableTui>::set_color(self, colors) } - #[inline] fn set_dim(&mut self, dim: bool) -> Result<(), DisplayError> { <T as MockableTui>::set_dim(self, dim) } - #[inline] fn set_underline(&mut self, underline: bool) -> Result<(), DisplayError> { <T as MockableTui>::set_underline(self, underline) } - #[inline] fn set_reverse(&mut self, reverse: bool) -> Result<(), DisplayError> { <T as MockableTui>::set_reverse(self, reverse) } - #[inline] fn get_size(&self) -> Size { <T as MockableTui>::get_size(self) } - #[inline] fn move_to_column(&mut self, x: u16) -> Result<(), DisplayError> { <T as MockableTui>::move_to_column(self, x) } - #[inline] fn move_next_line(&mut self) -> Result<(), DisplayError> { <T as MockableTui>::move_next_line(self) } |