fix: cargo-fix, cargo-clippy --fix

This commit is contained in:
Orion Kindel 2023-07-07 14:39:45 -05:00
parent 6fb5219796
commit c788ee1be1
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
3 changed files with 19 additions and 19 deletions

View File

@ -20,7 +20,7 @@ impl<Db> Ext for HashedTextExtImpl<Db> where Db: Postgres
impl<Db> HashedTextExt for HashedTextExtImpl<Db> where Db: Postgres
{
fn matches<S: AsRef<str>>(&self, this: &HashedText, other: S) -> Result<bool, DbError<Db>> {
static QUERY: &'static str =
static QUERY: &str =
"select public.hashed_text_matches($1, public.hashed_text_of_string($2))";
self.0
@ -31,11 +31,11 @@ impl<Db> HashedTextExt for HashedTextExtImpl<Db> where Db: Postgres
#[cfg(test)]
mod test {
use std::any::Any;
use std::panic::AssertUnwindSafe;
use postgres::types::private::BytesMut;
use postgres::types::{FromSql, ToSql, Type};
use postgres::types::{Type};
use super::{HashedText, HashedTextExt, HashedTextExtImpl};
use crate::postgres::test::{from_sql_owned, Client, Row};
@ -47,7 +47,7 @@ mod test {
assert_eq!(q.unwrap_str(), "select public.hashed_text_matches($1, public.hashed_text_of_string($2))");
assert_eq!(from_sql_owned::<String>(ps[1]), String::from("XXX"));
Ok(Row::new(vec![("", Type::BOOL)]).value(Type::BOOL, from_sql_owned::<String>(ps[0]) == String::from("foo")))
Ok(Row::new(vec![("", Type::BOOL)]).value(Type::BOOL, from_sql_owned::<String>(ps[0]) == *"foo"))
}),
..Client::default() };

View File

@ -1,18 +1,18 @@
use hashed_text::HashedTextExt;
use toad::config::Config;
use toad::net::Addrd;
use toad::platform::Platform as _;
use toad::req::Req;
use toad::resp::Resp;
use toad::std::dtls;
mod app;
mod hashed_text;
mod postgres;
mod repo;
mod user;
use repo::Repo;
use user::UserRepo;
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub struct Email(String);
@ -32,12 +32,12 @@ fn handle_request(req: Addrd<Req<ToadT>>) -> Result<Addrd<Resp<ToadT>>, String>
.map_err(|e| format!("{e:?}"))
.unwrap_or(None)
.unwrap_or("");
let mut path_segments = path.split("/").peekable();
let mut path_segments = path.split('/').peekable();
if path_segments.peek() == Some(&"users") {
let mut path_segments = path_segments.clone();
path_segments.next();
let id = path_segments.next();
let _id = path_segments.next();
}
Ok(req.map(|r| Resp::for_request(&r).unwrap()))

View File

@ -1,8 +1,8 @@
use std::ops::{Deref, DerefMut};
use std::ops::{DerefMut};
use std::pin::Pin;
use std::sync::{Mutex, MutexGuard, TryLockError};
use std::sync::{Mutex, MutexGuard};
use rand::{Rng, SeedableRng};
use rand::{Rng};
pub type DbError<Pg> = <<Pg as Postgres>::Client as postgres::GenericClient>::Error;
@ -374,15 +374,15 @@ pub mod test {
fn commit(mut self) -> Result<(), E> {
let mut f = Client::<E>::default().commit;
std::mem::swap(&mut self.commit, &mut f);
let res = f(self);
res
f(self)
}
fn rollback(mut self) -> Result<(), E> {
let mut f = Client::<E>::default().rollback;
std::mem::swap(&mut self.commit, &mut f);
let res = f(self);
res
f(self)
}
}