diff --git a/cursive-core/Cargo.toml b/cursive-core/Cargo.toml index 2a8e61cd..29e1a243 100644 --- a/cursive-core/Cargo.toml +++ b/cursive-core/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" repository = "https://github.com/gyscos/cursive" version = "0.4.6" edition = "2021" -rust-version = "1.61" +rust-version = "1.70" include = ["src/**/*", "LICENSE", "README.md"] [package.metadata.docs.rs] diff --git a/cursive-core/src/buffer.rs b/cursive-core/src/buffer.rs index b664c12a..64f66d09 100644 --- a/cursive-core/src/buffer.rs +++ b/cursive-core/src/buffer.rs @@ -155,7 +155,7 @@ pub struct Window<'a> { viewport: Rect, } -impl<'a> Window<'a> { +impl Window<'_> { /// Returns the cell at the given location. /// /// Returns `None` if the cell is empty because the previous one was double-wide. diff --git a/cursive-core/src/builder/resolvable.rs b/cursive-core/src/builder/resolvable.rs index 28558f38..bb3d95b3 100644 --- a/cursive-core/src/builder/resolvable.rs +++ b/cursive-core/src/builder/resolvable.rs @@ -1001,7 +1001,10 @@ impl Resolvable for crate::view::Offset { match key.as_str() { "Absolute" | "absolute" => Ok(Self::Absolute(context.resolve(value)?)), "Parent" | "parent" => Ok(Self::Parent(context.resolve(value)?)), - _ => Err(Error::invalid_config("Unexpected key `{key}`.", config)), + _ => Err(Error::invalid_config( + format!("Unexpected key `{key}`."), + config, + )), } } } diff --git a/cursive-core/src/event.rs b/cursive-core/src/event.rs index ebc904bf..cd7b4af3 100644 --- a/cursive-core/src/event.rs +++ b/cursive-core/src/event.rs @@ -112,10 +112,7 @@ impl EventTrigger { /// ); /// ``` pub fn has_tag(&self, tag: &T) -> bool { - (*self.tag) - .as_any() - .downcast_ref::() - .map_or(false, |t| tag == t) + (*self.tag).as_any().downcast_ref::() == Some(tag) } /// Checks if this trigger applies to the given `Event`. diff --git a/cursive-core/src/logger.rs b/cursive-core/src/logger.rs index 642958c7..d36524fd 100644 --- a/cursive-core/src/logger.rs +++ b/cursive-core/src/logger.rs @@ -29,7 +29,6 @@ use std::sync::{Mutex, RwLock}; /// logger::set_external_filter_level(LevelFilter::Debug); /// logger::init(); /// ``` - pub struct CursiveLogger; lazy_static! { diff --git a/cursive-core/src/utils/lines/simple/lines_iterator.rs b/cursive-core/src/utils/lines/simple/lines_iterator.rs index 1f2d7d3b..8669162d 100644 --- a/cursive-core/src/utils/lines/simple/lines_iterator.rs +++ b/cursive-core/src/utils/lines/simple/lines_iterator.rs @@ -25,7 +25,7 @@ impl<'a> DummySpannedText<'a> { } } -impl<'a> SpannedText for DummySpannedText<'a> { +impl SpannedText for DummySpannedText<'_> { type S = IndexedSpan<()>; fn source(&self) -> &str { @@ -58,7 +58,7 @@ impl<'a> LinesIterator<'a> { } } -impl<'a> Iterator for LinesIterator<'a> { +impl Iterator for LinesIterator<'_> { type Item = Row; fn next(&mut self) -> Option { diff --git a/cursive-core/src/utils/markup/ansi.rs b/cursive-core/src/utils/markup/ansi.rs index 4476f686..01e52bf0 100644 --- a/cursive-core/src/utils/markup/ansi.rs +++ b/cursive-core/src/utils/markup/ansi.rs @@ -176,7 +176,7 @@ impl<'a> Parser<'a> { } } -impl<'a> Iterator for Parser<'a> { +impl Iterator for Parser<'_> { type Item = StyledIndexedSpan; fn next(&mut self) -> Option { diff --git a/cursive-core/src/utils/markup/markdown.rs b/cursive-core/src/utils/markup/markdown.rs index 9ebb3cae..22169584 100644 --- a/cursive-core/src/utils/markup/markdown.rs +++ b/cursive-core/src/utils/markup/markdown.rs @@ -70,15 +70,12 @@ fn heading(level: usize) -> &'static str { &"##########"[..level] } -impl<'a> Iterator for Parser<'a> { +impl Iterator for Parser<'_> { type Item = StyledIndexedSpan; fn next(&mut self) -> Option { loop { - let next = match self.parser.next() { - None => return None, - Some(event) => event, - }; + let next = self.parser.next()?; match next { Event::Start(tag) => match tag { diff --git a/cursive-core/src/utils/markup/mod.rs b/cursive-core/src/utils/markup/mod.rs index 9679c74f..289b8d42 100644 --- a/cursive-core/src/utils/markup/mod.rs +++ b/cursive-core/src/utils/markup/mod.rs @@ -38,7 +38,7 @@ pub struct PlainStr<'a> { span: IndexedSpan