mirror of
https://github.com/nikolassv/bartib
synced 2025-02-26 03:47:09 +00:00
satisfy clippy
This commit is contained in:
parent
6d31caa73f
commit
e32ed45110
2 changed files with 7 additions and 6 deletions
|
@ -28,7 +28,8 @@ pub struct Line {
|
|||
|
||||
impl Line {
|
||||
// creates a new line struct from plaintext
|
||||
#[must_use] pub fn new(plaintext: &str, line_number: usize) -> Self {
|
||||
#[must_use]
|
||||
pub fn new(plaintext: &str, line_number: usize) -> Self {
|
||||
Self {
|
||||
plaintext: Some(plaintext.trim().to_string()),
|
||||
line_number: Some(line_number),
|
||||
|
@ -38,7 +39,8 @@ impl Line {
|
|||
}
|
||||
|
||||
// creates a new line from an existing activity
|
||||
#[must_use] pub fn for_activity(activity: activity::Activity) -> Self {
|
||||
#[must_use]
|
||||
pub fn for_activity(activity: activity::Activity) -> Self {
|
||||
Self {
|
||||
plaintext: None,
|
||||
line_number: None,
|
||||
|
@ -61,7 +63,7 @@ pub fn get_file_content(file_name: &str) -> Result<Vec<Line>> {
|
|||
|
||||
let lines = reader
|
||||
.lines()
|
||||
.filter_map(std::result::Result::ok)
|
||||
.map_while(Result::ok)
|
||||
.enumerate()
|
||||
.map(|(line_number, line)| Line::new(&line, line_number.saturating_add(1)))
|
||||
.collect();
|
||||
|
|
|
@ -32,8 +32,7 @@ impl<'a> fmt::Display for Report<'a> {
|
|||
let mut longest_line = get_longest_line(&self.project_map).unwrap_or(0);
|
||||
let longest_duration_string = get_longest_duration_string(self).unwrap_or(0);
|
||||
|
||||
let terminal_width = term_size::dimensions_stdout()
|
||||
.map_or(conf::DEFAULT_WIDTH, |d| d.0);
|
||||
let terminal_width = term_size::dimensions_stdout().map_or(conf::DEFAULT_WIDTH, |d| d.0);
|
||||
|
||||
if terminal_width < longest_line + longest_duration_string + 1 {
|
||||
longest_line = terminal_width - longest_duration_string - 1;
|
||||
|
@ -73,7 +72,7 @@ fn create_project_map<'a>(activities: &'a [&'a activity::Activity]) -> ProjectMa
|
|||
.push(a);
|
||||
}
|
||||
|
||||
for (_project, (activities, duration)) in &mut project_map {
|
||||
for (activities, duration) in project_map.values_mut() {
|
||||
*duration = sum_duration(activities);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue