chore: fix new lints (#1922)
This commit is contained in:
@@ -185,7 +185,7 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
fn title_block(title: &str) -> Block {
|
||||
fn title_block(title: &str) -> Block<'_> {
|
||||
let title = Line::from(title).centered();
|
||||
Block::new()
|
||||
.borders(Borders::NONE)
|
||||
|
||||
@@ -69,7 +69,7 @@ impl App {
|
||||
}
|
||||
|
||||
/// Create a vertical bar chart from the temperatures data.
|
||||
fn vertical_barchart(temperatures: &[u8]) -> BarChart {
|
||||
fn vertical_barchart(temperatures: &[u8]) -> BarChart<'_> {
|
||||
let bars: Vec<Bar> = temperatures
|
||||
.iter()
|
||||
.enumerate()
|
||||
@@ -80,7 +80,7 @@ fn vertical_barchart(temperatures: &[u8]) -> BarChart {
|
||||
.bar_width(5)
|
||||
}
|
||||
|
||||
fn vertical_bar(hour: usize, temperature: &u8) -> Bar {
|
||||
fn vertical_bar(hour: usize, temperature: &u8) -> Bar<'_> {
|
||||
Bar::default()
|
||||
.value(u64::from(*temperature))
|
||||
.label(Line::from(format!("{hour:>02}:00")))
|
||||
|
||||
@@ -1237,7 +1237,7 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Emojis normally contain various characters which should stay part of the Emoji.
|
||||
/// This should work fine by utilizing unicode_segmentation but a testcase is probably helpful
|
||||
/// This should work fine by utilizing `unicode_segmentation` but a testcase is probably helpful
|
||||
/// due to the nature of never perfect Unicode implementations and all of its quirks.
|
||||
#[rstest]
|
||||
// Shrug without gender or skintone. Has a width of 2 like all emojis have.
|
||||
|
||||
@@ -166,7 +166,7 @@ where
|
||||
}
|
||||
|
||||
/// Get a Frame object which provides a consistent view into the terminal state for rendering.
|
||||
pub const fn get_frame(&mut self) -> Frame {
|
||||
pub const fn get_frame(&mut self) -> Frame<'_> {
|
||||
let count = self.frame_count;
|
||||
Frame {
|
||||
cursor_position: None,
|
||||
@@ -299,7 +299,7 @@ where
|
||||
/// }
|
||||
/// # std::io::Result::Ok(())
|
||||
/// ```
|
||||
pub fn draw<F>(&mut self, render_callback: F) -> Result<CompletedFrame, B::Error>
|
||||
pub fn draw<F>(&mut self, render_callback: F) -> Result<CompletedFrame<'_>, B::Error>
|
||||
where
|
||||
F: FnOnce(&mut Frame),
|
||||
{
|
||||
@@ -374,7 +374,7 @@ where
|
||||
/// }
|
||||
/// # io::Result::Ok(())
|
||||
/// ```
|
||||
pub fn try_draw<F, E>(&mut self, render_callback: F) -> Result<CompletedFrame, B::Error>
|
||||
pub fn try_draw<F, E>(&mut self, render_callback: F) -> Result<CompletedFrame<'_>, B::Error>
|
||||
where
|
||||
F: FnOnce(&mut Frame) -> Result<(), E>,
|
||||
E: Into<B::Error>,
|
||||
|
||||
@@ -534,12 +534,12 @@ impl<'a> Line<'a> {
|
||||
}
|
||||
|
||||
/// Returns an iterator over the spans of this line.
|
||||
pub fn iter(&self) -> core::slice::Iter<Span<'a>> {
|
||||
pub fn iter(&self) -> core::slice::Iter<'_, Span<'a>> {
|
||||
self.spans.iter()
|
||||
}
|
||||
|
||||
/// Returns a mutable iterator over the spans of this line.
|
||||
pub fn iter_mut(&mut self) -> core::slice::IterMut<Span<'a>> {
|
||||
pub fn iter_mut(&mut self) -> core::slice::IterMut<'_, Span<'a>> {
|
||||
self.spans.iter_mut()
|
||||
}
|
||||
|
||||
|
||||
@@ -507,12 +507,12 @@ impl<'a> Text<'a> {
|
||||
}
|
||||
|
||||
/// Returns an iterator over the lines of the text.
|
||||
pub fn iter(&self) -> core::slice::Iter<Line<'a>> {
|
||||
pub fn iter(&self) -> core::slice::Iter<'_, Line<'a>> {
|
||||
self.lines.iter()
|
||||
}
|
||||
|
||||
/// Returns an iterator that allows modifying each line.
|
||||
pub fn iter_mut(&mut self) -> core::slice::IterMut<Line<'a>> {
|
||||
pub fn iter_mut(&mut self) -> core::slice::IterMut<'_, Line<'a>> {
|
||||
self.lines.iter_mut()
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ pub trait ToText {
|
||||
/// error. This indicates an incorrect `Display` implementation since `fmt::Write for String` never
|
||||
/// returns an error itself.
|
||||
impl<T: fmt::Display> ToText for T {
|
||||
fn to_text(&self) -> Text {
|
||||
fn to_text(&self) -> Text<'_> {
|
||||
Text::raw(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ impl Block<'_> {
|
||||
&self,
|
||||
position: Position,
|
||||
alignment: Alignment,
|
||||
) -> impl DoubleEndedIterator<Item = &Line> {
|
||||
) -> impl DoubleEndedIterator<Item = &Line<'_>> {
|
||||
self.titles
|
||||
.iter()
|
||||
.filter(move |(pos, _)| pos.unwrap_or(self.titles_position) == position)
|
||||
|
||||
@@ -113,7 +113,7 @@ impl<'a, DS: DateStyler> Monthly<'a, DS> {
|
||||
}
|
||||
|
||||
/// All logic to style a date goes here.
|
||||
fn format_date(&self, date: Date) -> Span {
|
||||
fn format_date(&self, date: Date) -> Span<'_> {
|
||||
if date.month() == self.display_date.month() {
|
||||
Span::styled(
|
||||
format!("{:2?}", date.day()),
|
||||
|
||||
Reference in New Issue
Block a user