clippy lints
This commit is contained in:
parent
086feb0e0b
commit
dd40c1acc8
|
@ -11,7 +11,7 @@ use chrono::Weekday;
|
|||
|
||||
use crate::{error::{Result, Error::{self, *}}, formatters::Formatter};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum WeekDay {
|
||||
Monday,
|
||||
Tuesday,
|
||||
|
|
|
@ -6,7 +6,7 @@ use chrono::{DateTime, Utc};
|
|||
use crate::error::{Error, Result};
|
||||
use crate::models::{Entry, Meta};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum DBVersion {
|
||||
Timetrap,
|
||||
Version(u16),
|
||||
|
@ -243,7 +243,7 @@ pub trait Database {
|
|||
}
|
||||
|
||||
pub struct SqliteDatabase {
|
||||
connection: Connection,
|
||||
connection: Connection,
|
||||
}
|
||||
|
||||
impl SqliteDatabase {
|
||||
|
@ -279,6 +279,7 @@ impl Database for SqliteDatabase {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::let_and_return)]
|
||||
fn entry_query(&self, query: &str, params: &[&dyn ToSql]) -> Result<Vec<Entry>> {
|
||||
let mut stmt = self.connection.prepare(query)?;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub fn get_string(note_editor: Option<&str>, prev_contents: Option<String>) -> R
|
|||
};
|
||||
|
||||
let parts: Vec<_> = note_editor.split(' ').filter(|p| !p.is_empty()).collect();
|
||||
let editor = if let Some(name) = parts.get(0) {
|
||||
let editor = if let Some(name) = parts.first() {
|
||||
name.to_owned()
|
||||
} else {
|
||||
return Err(EditorIsEmpty);
|
||||
|
|
|
@ -144,9 +144,9 @@ pub fn print_formatted<W: Write>(entries: Vec<Entry>, out: &mut W, facts: &Facts
|
|||
|
||||
if greens < daily_goal_blocks {
|
||||
// print the missing blocks in gray
|
||||
out.push_str(&Style::new().on(White).paint(" ".repeat(daily_goal_blocks - greens)).to_string());
|
||||
out.push_str(&Style::new().on(White).paint(" ".repeat(daily_goal_blocks - greens)));
|
||||
} else if total_blocks > daily_goal_blocks {
|
||||
out.push_str(&Style::new().on(Fixed(10)).paint(" ".repeat(total_blocks - daily_goal_blocks)).to_string());
|
||||
out.push_str(&Style::new().on(Fixed(10)).paint(" ".repeat(total_blocks - daily_goal_blocks)));
|
||||
}
|
||||
|
||||
out
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use chrono::{DateTime, Utc, Duration};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct Entry {
|
||||
pub id: u64,
|
||||
pub note: Option<String>,
|
||||
|
|
Loading…
Reference in New Issue