Clippy Feedback

pull/24/head
Benedikt Terhechte 2 years ago
parent 9a35b99971
commit e8f9d9fdb5

@ -55,8 +55,8 @@ impl Entry {
fn as_row(&self, fields: &[Field]) -> QueryRow {
let mut row = QueryRow::new();
for field in fields {
let value = self.value(&field);
let value_field = ValueField::new(&field, value);
let value = self.value(field);
let value_field = ValueField::new(field, value);
row.insert(*field, value_field);
}
row
@ -66,6 +66,7 @@ impl Entry {
#[derive(Debug, PartialEq, Eq)]
struct HashedValue(Value);
#[allow(clippy::derive_hash_xor_eq)]
impl Hash for HashedValue {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
match &self.0 {
@ -85,14 +86,15 @@ impl Hash for HashedValue {
pub struct FakeDatabase;
impl FakeDatabase {
#[allow(unused)]
pub fn total_item_count() -> usize {
ENTRIES.len()
}
fn query_normal(
&self,
fields: &Vec<Field>,
filters: &Vec<Filter>,
fields: &[Field],
filters: &[Filter],
range: &Range<usize>,
) -> Vec<QueryResult> {
let entries = self.filtered(filters);
@ -103,7 +105,7 @@ impl FakeDatabase {
result
}
fn query_grouped(&self, filters: &Vec<Filter>, group_by: &Field) -> Vec<QueryResult> {
fn query_grouped(&self, filters: &[Filter], group_by: &Field) -> Vec<QueryResult> {
let mut map = HashMap::<HashedValue, usize>::new();
for entry in self
.filtered(filters)
@ -139,7 +141,7 @@ impl FakeDatabase {
result
}
fn filtered<'a>(&'a self, filters: &'a Vec<Filter>) -> impl Iterator<Item = &'a Entry> {
fn filtered<'a>(&'a self, filters: &'a [Filter]) -> impl Iterator<Item = &'a Entry> {
ENTRIES.iter().filter(move |entry| {
for filter in filters {
// Go through all filters and escape early if they don't match

@ -1,4 +1,3 @@
use crossbeam_channel;
use eyre::Result;
use std::thread::JoinHandle;

@ -42,6 +42,7 @@ pub struct Adapter {
}
impl Adapter {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
let rw_lock = Arc::new(RwLock::default());
// FIXME: Look up this warning. It looks like the clones are necessary?

@ -200,5 +200,5 @@ fn random_filename() -> String {
use rand::Rng;
let number: u32 = rand::thread_rng().gen();
let filename = format!("{}.sqlite", number);
return filename;
filename
}

@ -19,6 +19,7 @@ pub struct PostsackApp<Database: DatabaseLike> {
}
impl<Database: DatabaseLike> PostsackApp<Database> {
#[allow(clippy::new_without_default)]
#[cfg(not(target_arch = "wasm32"))]
pub fn new() -> Self {
let state = StateUI::new();

@ -15,9 +15,6 @@ use ps_core::{
Config, DatabaseLike, FormatType,
};
#[cfg(not(target_arch = "wasm32"))]
use ps_importer;
pub struct ImporterUI {
/// The config for this configuration
config: Config,

@ -6,7 +6,6 @@
const SYSTEM_FONT: &[u8] = include_bytes!("../fonts/mac_regular.otf");
const SYSTEM_MONO_FONT: &[u8] = include_bytes!("../fonts/mac_mono.ttc");
use cocoa;
use eframe::egui::{self, Color32, FontDefinitions, FontFamily, Stroke};
use ps_core::eyre::{bail, Result};

@ -1,7 +1,7 @@
#![cfg(target_arch = "wasm32")]
use eframe::egui::{self, Color32};
use eyre::Result;
use ps_core::eyre::Result;
use super::{PlatformColors, Theme};

@ -12,9 +12,6 @@ use eframe::{self, epi};
#[cfg(target_os = "macos")]
use eframe::{self, egui, epi};
#[cfg(target_os = "macos")]
use image;
/// Pre-loaded textures
pub struct Textures {
#[cfg(target_os = "macos")]

@ -1,7 +1,6 @@
mod filesystem;
mod mail;
use shellexpand;
use std::{path::PathBuf, str::FromStr};
use super::{ImporterFormat, Result};

@ -4,7 +4,6 @@
//! (or aho corasick)
//! MBox parsing is also not particularly fast as it currently doesn't use parallelism
use mbox_reader;
use ps_core::eyre::eyre;
use ps_core::tracing;
use rayon::prelude::*;

Loading…
Cancel
Save