Apply clippy suggestions (#35)

Co-authored-by: Miroito <alban.vachette@gmail.com>
Reviewed-on: #35
pull/37/head
alban 3 years ago
parent bc199c674d
commit afcf697b21

61
Cargo.lock generated

@ -228,17 +228,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@ -900,19 +889,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "env_logger"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "envy"
version = "0.4.2"
@ -1260,15 +1236,6 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
@ -1333,15 +1300,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "humantime"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
[[package]]
name = "hyper"
version = "0.14.26"
@ -1763,7 +1721,7 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi 0.2.6",
"hermit-abi",
"libc",
]
@ -2079,16 +2037,6 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "pretty_env_logger"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
dependencies = [
"env_logger",
"log",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
@ -2157,12 +2105,6 @@ dependencies = [
"syn 1.0.108",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.26"
@ -2767,7 +2709,6 @@ dependencies = [
"log",
"lopdf",
"migration",
"pretty_env_logger",
"reqwest",
"sea-orm",
"serde",

@ -38,7 +38,7 @@ impl FastInsidersApi {
.await
.map_err(|_| ())?;
return Ok(res);
Ok(res)
}
pub async fn get_aggregated_transactions(
@ -72,7 +72,7 @@ impl FastInsidersApi {
.await
.map_err(|_| ())?;
return Ok(res);
Ok(res)
}
pub async fn get_latest_transactions(
@ -103,6 +103,6 @@ impl FastInsidersApi {
.await
.map_err(|_| ())?;
return Ok(res);
Ok(res)
}
}

@ -9,7 +9,7 @@ pub trait IntoTableData<G>
where
G: GenericNode,
{
fn into_table_data<'a>(self, cx: Scope<'a>) -> TableContent<G>;
fn into_table_data(self, cx: Scope) -> TableContent<G>;
}
#[derive(Clone, Serialize, Deserialize)]
@ -23,7 +23,7 @@ impl<G> IntoTableData<G> for PaginatedResponse<TransactionCompany>
where
G: GenericNode,
{
fn into_table_data<'a>(self, cx: Scope<'a>) -> TableContent<G> {
fn into_table_data(self, cx: Scope) -> TableContent<G> {
let headers_view = vec![
view! {cx, "Company" },
view! {cx, "Date published" },
@ -45,7 +45,7 @@ where
let mut res = vec![];
res.push(view! {cx,
a (href=format!("transactions/{}", t.company.slug),
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 dark:hover:text-indigo-600 hover:underline",
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 hover:underline dark:hover:text-indigo-600",
) {
(t.company.name.to_owned())
}
@ -76,7 +76,7 @@ impl<G> IntoTableData<G> for PaginatedResponse<TransactionsAggregated>
where
G: GenericNode,
{
fn into_table_data<'a>(self, cx: Scope<'a>) -> TableContent<G> {
fn into_table_data(self, cx: Scope) -> TableContent<G> {
let headers_view = vec![
view! {cx, "Company" },
view! {cx, "Transactions" },
@ -89,7 +89,7 @@ where
let mut res = vec![];
res.push(view! {cx,
a (href=format!("transactions/{}", t.slug),
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 dark:hover:text-indigo-600 hover:underline",
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 hover:underline dark:hover:text-indigo-600",
) {
(t.name.to_owned())
}
@ -111,7 +111,7 @@ impl<G> IntoTableData<G> for PaginatedResponse<LatestTransaction>
where
G: GenericNode,
{
fn into_table_data<'a>(self, cx: Scope<'a>) -> TableContent<G> {
fn into_table_data(self, cx: Scope) -> TableContent<G> {
let headers_view = vec![
view! {cx, "Company" },
view! {cx, "nature" },
@ -125,7 +125,7 @@ where
let mut res = vec![];
res.push(view! {cx,
a (href=format!("transactions/{}", t.slug),
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 dark:hover:text-indigo-600 hover:underline",
class="text-indigo-800 dark:text-indigo-300 hover:text-indigo-500 hover:underline dark:hover:text-indigo-600",
) {
(t.company_name.to_owned())
}

@ -4,7 +4,7 @@ use sycamore::prelude::*;
use crate::global_state::AppStateRx;
#[component]
pub fn TheHeader<'a, G: Html>(cx: Scope<'a>) -> View<G> {
pub fn TheHeader<G: Html>(cx: Scope) -> View<G> {
// This is ugly and is only caused by the get_global_state function panicking when running on the server at build time
let global_state_sig: &Signal<Option<&AppStateRx>> = create_signal(cx, None);
@ -15,7 +15,7 @@ pub fn TheHeader<'a, G: Html>(cx: Scope<'a>) -> View<G> {
let dark_mode = create_signal(cx, true);
create_effect(cx, move || {
if let Some(gstate) = (*global_state_sig.get()).clone() {
if let Some(gstate) = *global_state_sig.get() {
dark_mode.set(*gstate.dark_mode.get());
}
});
@ -26,7 +26,7 @@ pub fn TheHeader<'a, G: Html>(cx: Scope<'a>) -> View<G> {
};
view! { cx,
header (class="shadow-md h-11 p-2 align-middle w-full bg-gray-100 dark:bg-slate-500/30 backdrop-blur-lg") {
header (class="p-2 w-full h-11 align-middle bg-gray-100 shadow-md backdrop-blur-lg dark:bg-slate-500/30") {
div (class="flex") {
div (class="flex-none mr-12") {
a (href="/", class="hover:underline") {

@ -49,7 +49,7 @@ fn transactions_page<'a, G: Html>(cx: Scope, state: &TransactionsPageStateRx) ->
let route_ref = create_ref(cx, |n, l| api_scope_ref.get_company_by_name(n, l));
let async_select_prop: AsyncSelectRx<_, _, _> = AsyncSelectRx {
route: create_ref(cx, |n, l| api_scope_ref.get_company_by_name(n, l)),
route: route_ref,
selected_item: create_signal(cx, None),
};

@ -52,7 +52,7 @@ async fn index(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
.select_by_value(&page_size.to_string())
.await?;
let table_rows = c.find_all(Locator::Css("table tr")).await?.iter().count();
let table_rows = c.find_all(Locator::Css("table tr")).await?.len();
let page_size_select = c.find(Locator::Css("#size-select")).await?;
let browser_page_size = page_size_select
.prop("value")
@ -71,7 +71,7 @@ async fn index(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
.await?
.text()
.await?
.split("/")
.split('/')
.map(|x| x.parse().unwrap())
.collect::<Vec<usize>>();
assert_eq!(page_numbers[0], 1);
@ -81,7 +81,7 @@ async fn index(c: &mut Client) -> Result<(), fantoccini::error::CmdError> {
.await?
.text()
.await?
.split("/")
.split('/')
.map(|x| x.parse().unwrap())
.collect::<Vec<usize>>();
assert_eq!(new_page_numbers[0], page_numbers[0] + 1);

@ -25,7 +25,6 @@ sea-orm = { version = "0.11.0", features = [
lopdf = "0.29.0"
bytes = { version = "1.3.0", features = ["serde"] }
lazy_static = "1.4.0"
pretty_env_logger = "0.4.0"
log = "0.4.17"
futures = "0.3.25"
async-trait = "0.1.61"

@ -41,16 +41,12 @@ impl AMFRequest {
}
}
#[derive(Default)]
pub enum AMFRequestType {
#[default]
DD,
}
impl Default for AMFRequestType {
fn default() -> Self {
AMFRequestType::DD
}
}
impl fmt::Display for AMFRequestType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {

@ -1,7 +0,0 @@
extern crate pretty_env_logger;
use log::SetLoggerError;
/// For this function to do anything the RUST_LOG environment variable should be set.
pub fn init_log() -> Result<(), SetLoggerError> {
pretty_env_logger::try_init_timed()
}

@ -3,7 +3,6 @@
// Macros
#[macro_use]
extern crate lazy_static;
extern crate pretty_env_logger;
#[macro_use]
extern crate log;
@ -30,7 +29,6 @@ mod amf;
mod db;
mod env;
mod error;
mod logger;
mod model;
mod repo;
mod route;

@ -21,7 +21,7 @@ pub async fn run_tasks(tasks_pool: &DatabaseConnection) -> Result<(), sea_orm::D
loop {
inter.tick().await;
info!("Running task: getamftransactions");
match GetAMFTransactions::new(1000).run(&tasks_pool).await {
match GetAMFTransactions::new(1000).run(tasks_pool).await {
Ok(_) => (),
Err(e) => error!("Task failed: {}", e),
};

Loading…
Cancel
Save