summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2023-12-27 10:00:11 +0100
committerSebastian Thiel <sebastian.thiel@icloud.com>2023-12-27 10:01:08 +0100
commit45d886a6b2c194a5a68961b428f8db2c8daf06a8 (patch)
treea6b29b0b2eaf9c188620d2978097d66617134342
parent4482e1de9808a8d662b93b3af907b90000e9f1ae (diff)
enforce Rust 2021 style
-rw-r--r--src/interactive/app/bytevis.rs10
-rw-r--r--src/interactive/app/eventloop.rs4
-rw-r--r--src/interactive/widgets/help.rs2
-rw-r--r--src/main.rs2
4 files changed, 11 insertions, 7 deletions
diff --git a/src/interactive/app/bytevis.rs b/src/interactive/app/bytevis.rs
index d767ed1..1d1bc33 100644
--- a/src/interactive/app/bytevis.rs
+++ b/src/interactive/app/bytevis.rs
@@ -34,7 +34,7 @@ impl ByteVisualization {
}
impl fmt::Display for DisplayByteVisualization {
- fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
use ByteVisualization::*;
let Self { format, percentage } = self;
@@ -58,7 +58,11 @@ impl fmt::Display for DisplayByteVisualization {
}
impl DisplayByteVisualization {
- fn make_bar(f: &mut fmt::Formatter, percentage: f32, length: usize) -> Result<(), fmt::Error> {
+ fn make_bar(
+ f: &mut fmt::Formatter<'_>,
+ percentage: f32,
+ length: usize,
+ ) -> Result<(), fmt::Error> {
// Print the filled part of the bar
let block_length = (length as f32 * percentage).floor() as usize;
for _ in 0..block_length {
@@ -90,7 +94,7 @@ impl DisplayByteVisualization {
}
Ok(())
}
- fn make_percentage(f: &mut fmt::Formatter, percentage: f32) -> Result<(), fmt::Error> {
+ fn make_percentage(f: &mut fmt::Formatter<'_>, percentage: f32) -> Result<(), fmt::Error> {
write!(f, " {:>5.01}% ", percentage * 100.0)
}
}
diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs
index 18e4bf7..36f60e0 100644
--- a/src/interactive/app/eventloop.rs
+++ b/src/interactive/app/eventloop.rs
@@ -235,7 +235,7 @@ impl AppState {
}
}
- fn search_glob_pattern(&mut self, tree_view: &mut TreeView, glob_pattern: &str) {
+ fn search_glob_pattern(&mut self, tree_view: &mut TreeView<'_>, glob_pattern: &str) {
use FocussedPane::*;
match glob_search(tree_view.tree(), self.navigation.view_root, glob_pattern) {
Ok(matches) if matches.is_empty() => {
@@ -321,7 +321,7 @@ impl AppState {
pub fn draw_window<B>(
window: &mut MainWindow,
- props: MainWindowProps,
+ props: MainWindowProps<'_>,
terminal: &mut Terminal<B>,
cursor: &mut Cursor,
) -> Result<()>
diff --git a/src/interactive/widgets/help.rs b/src/interactive/widgets/help.rs
index 092fb00..8ae65b2 100644
--- a/src/interactive/widgets/help.rs
+++ b/src/interactive/widgets/help.rs
@@ -61,7 +61,7 @@ impl HelpPane {
pub fn render(&mut self, props: impl Borrow<HelpPaneProps>, area: Rect, buf: &mut Buffer) {
let lines = {
- let lines = RefCell::new(Vec::<Line>::with_capacity(30));
+ let lines = RefCell::new(Vec::<Line<'_>>::with_capacity(30));
let add_newlines = |n| {
for _ in 0..n {
lines.borrow_mut().push(Line::from(Span::raw("")))
diff --git a/src/main.rs b/src/main.rs
index 861700a..42bb4f3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,4 @@
-#![forbid(unsafe_code)]
+#![forbid(unsafe_code, rust_2018_idioms, unsafe_code)]
use anyhow::Result;
#[macro_use]
extern crate log;