diff --git a/Cargo.lock b/Cargo.lock index 18e722da..132356fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -186,7 +186,6 @@ dependencies = [ "sha2", "sqlx", "thiserror", - "time", "tokio", "tracing", "uuid", @@ -1702,7 +1701,6 @@ dependencies = [ "serde", "serde_json", "sqlx", - "time", "tokio", "tracing", "tracing-subscriber", diff --git a/Cargo.toml b/Cargo.toml index 6e10216c..af0f6674 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "./crates/*" ] +resolver = "2" [workspace.dependencies] anyhow = "1" @@ -19,7 +20,6 @@ serde = { version = "1.0.196", features = ["derive"] } serde_json = "1.0.117" signal-hook = "0.3.17" sqlx = { version = "0.8.2", features = ["runtime-tokio", "postgres", "time", "macros", "uuid"] } -time = "0.3.34" tokio = { version = "1.36.0", features = ["full"] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.16", features = ["env-filter", "json"] } diff --git a/Myriad/Cache/HTTPDiscordCache.cs b/Myriad/Cache/HTTPDiscordCache.cs index e6aac7ee..31035660 100644 --- a/Myriad/Cache/HTTPDiscordCache.cs +++ b/Myriad/Cache/HTTPDiscordCache.cs @@ -165,6 +165,8 @@ public class HttpDiscordCache: IDiscordCache // return hres; // } + // it's fine +#pragma warning disable CS8603 public async Task> GetGuildChannels(ulong guildId) { var hres = await QueryCache>($"/guilds/{guildId}/channels", guildId); diff --git a/Myriad/Gateway/ShardConnection.cs b/Myriad/Gateway/ShardConnection.cs index c1fea661..648246f1 100644 --- a/Myriad/Gateway/ShardConnection.cs +++ b/Myriad/Gateway/ShardConnection.cs @@ -70,7 +70,7 @@ public class ShardConnection: IAsyncDisposable var (_, packet) = await _serializer.ReadPacket(_client); return packet; } - catch (Exception e) + catch (Exception) { // these are never useful // _logger.Error(e, "Shard {ShardId}: Error reading from WebSocket"); diff --git a/Myriad/Rest/DiscordApiClient.cs b/Myriad/Rest/DiscordApiClient.cs index c413f5bd..cb1bd83c 100644 --- a/Myriad/Rest/DiscordApiClient.cs +++ b/Myriad/Rest/DiscordApiClient.cs @@ -159,7 +159,7 @@ public class DiscordApiClient public Task CreateDm(ulong recipientId) => _client.Post("/users/@me/channels", ("CreateDM", default), new CreateDmRequest(recipientId))!; - public Task RefreshUrls(string[] urls) => + public Task RefreshUrls(string[] urls) => _client.Post("/attachments/refresh-urls", ("RefreshUrls", default), new RefreshUrlsRequest(urls)); private static string EncodeEmoji(Emoji emoji) => diff --git a/crates/api/src/error.rs b/crates/api/src/error.rs index 48f59d82..464534d8 100644 --- a/crates/api/src/error.rs +++ b/crates/api/src/error.rs @@ -1,6 +1,8 @@ use axum::http::StatusCode; use std::fmt; +// todo +#[allow(dead_code)] #[derive(Debug)] pub struct PKError { pub response_code: StatusCode, @@ -16,6 +18,7 @@ impl fmt::Display for PKError { impl std::error::Error for PKError {} +#[allow(unused_macros)] macro_rules! define_error { ( $name:ident, $response_code:expr, $json_code:expr, $message:expr ) => { const $name: PKError = PKError { @@ -26,4 +29,4 @@ macro_rules! define_error { }; } -define_error! { GENERIC_BAD_REQUEST, StatusCode::BAD_REQUEST, 0, "400: Bad Request" } +// define_error! { GENERIC_BAD_REQUEST, StatusCode::BAD_REQUEST, 0, "400: Bad Request" } diff --git a/crates/api/src/util.rs b/crates/api/src/util.rs index b2aa4419..03121659 100644 --- a/crates/api/src/util.rs +++ b/crates/api/src/util.rs @@ -20,6 +20,7 @@ pub fn header_or_unknown(header: Option<&HeaderValue>) -> &str { } } +#[allow(dead_code)] pub fn wrapper(handler: F) -> impl Fn() -> axum::response::Response where F: Fn() -> anyhow::Result, diff --git a/crates/avatars/Cargo.toml b/crates/avatars/Cargo.toml index cb42ff84..725e5396 100644 --- a/crates/avatars/Cargo.toml +++ b/crates/avatars/Cargo.toml @@ -15,7 +15,6 @@ futures = { workspace = true } reqwest = { workspace = true } serde = { workspace = true } sqlx = { workspace = true } -time = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } uuid = { workspace = true } diff --git a/crates/avatars/src/main.rs b/crates/avatars/src/main.rs index dca35f77..52ea05f8 100644 --- a/crates/avatars/src/main.rs +++ b/crates/avatars/src/main.rs @@ -1,5 +1,5 @@ mod hash; -mod migrate; +// mod migrate; mod process; mod pull; mod store; diff --git a/crates/avatars/src/process.rs b/crates/avatars/src/process.rs index a5d5a752..61eaaef2 100644 --- a/crates/avatars/src/process.rs +++ b/crates/avatars/src/process.rs @@ -1,7 +1,7 @@ use image::{DynamicImage, ImageFormat}; use std::borrow::Cow; use std::io::Cursor; -use time::Instant; +use std::time::Instant; use tracing::{debug, error, info, instrument}; use crate::{hash::Hash, ImageKind, PKAvatarError}; @@ -100,10 +100,10 @@ pub fn process(data: &[u8], kind: ImageKind) -> Result, pub content_type: String, @@ -85,16 +85,16 @@ pub async fn pull( "{}: {} (headers: {}ms, body: {}ms)", status, &trimmed_url, - headers_time.whole_milliseconds(), - body_time.whole_milliseconds() + headers_time.as_millis(), + body_time.as_millis() ); } else { tracing::info!( "{}: {} (headers: {}ms, body: {}ms)", status, &trimmed_url, - headers_time.whole_milliseconds(), - body_time.whole_milliseconds() + headers_time.as_millis(), + body_time.as_millis() ); }; @@ -105,6 +105,7 @@ pub async fn pull( }) } +#[allow(dead_code)] #[derive(Debug)] pub struct ParsedUrl { pub channel_id: u64, diff --git a/crates/dispatch/src/main.rs b/crates/dispatch/src/main.rs index a9d6d2af..c61ea38e 100644 --- a/crates/dispatch/src/main.rs +++ b/crates/dispatch/src/main.rs @@ -54,6 +54,7 @@ struct DispatchRequest { test: Option, } +#[allow(dead_code)] #[derive(Debug)] enum DispatchResponse { OK, diff --git a/crates/libpk/Cargo.toml b/crates/libpk/Cargo.toml index 714e7d00..4b084038 100644 --- a/crates/libpk/Cargo.toml +++ b/crates/libpk/Cargo.toml @@ -12,7 +12,6 @@ sentry = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } sqlx = { workspace = true } -time = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true} diff --git a/crates/libpk/src/db/types/avatars.rs b/crates/libpk/src/db/types/avatars.rs index 928c3e99..41a8f8de 100644 --- a/crates/libpk/src/db/types/avatars.rs +++ b/crates/libpk/src/db/types/avatars.rs @@ -1,6 +1,5 @@ use serde::{Deserialize, Serialize}; -use sqlx::FromRow; -use time::OffsetDateTime; +use sqlx::{types::chrono::NaiveDateTime, FromRow}; use uuid::Uuid; #[derive(FromRow)] @@ -12,7 +11,7 @@ pub struct ImageMeta { pub file_size: i32, pub width: i32, pub height: i32, - pub uploaded_at: Option, + pub uploaded_at: Option, pub original_url: Option, pub original_attachment_id: Option, diff --git a/crates/model_macros/src/lib.rs b/crates/model_macros/src/lib.rs index aead66df..77f286e2 100644 --- a/crates/model_macros/src/lib.rs +++ b/crates/model_macros/src/lib.rs @@ -112,7 +112,7 @@ pub fn pk_model( let tfields = mk_tfields(fields.clone()); let from_json = mk_tfrom_json(fields.clone()); - let from_sql = mk_tfrom_sql(fields.clone()); + let _from_sql = mk_tfrom_sql(fields.clone()); let to_json = mk_tto_json(fields.clone()); let fields: Vec = fields @@ -182,10 +182,10 @@ fn mk_tfields(fields: Vec) -> TokenStream { }) .collect() } -fn mk_tfrom_json(fields: Vec) -> TokenStream { +fn mk_tfrom_json(_fields: Vec) -> TokenStream { quote! { unimplemented!(); } } -fn mk_tfrom_sql(fields: Vec) -> TokenStream { +fn mk_tfrom_sql(_fields: Vec) -> TokenStream { quote! { unimplemented!(); } } fn mk_tto_json(fields: Vec) -> TokenStream { @@ -248,12 +248,12 @@ fn mk_patch_fields(fields: Vec) -> TokenStream { fn mk_patch_validate(_fields: Vec) -> TokenStream { quote! { true } } -fn mk_patch_from_json(fields: Vec) -> TokenStream { +fn mk_patch_from_json(_fields: Vec) -> TokenStream { quote! { unimplemented!(); } } -fn mk_patch_to_sql(fields: Vec) -> TokenStream { +fn mk_patch_to_sql(_fields: Vec) -> TokenStream { quote! { unimplemented!(); } } -fn mk_patch_to_json(fields: Vec) -> TokenStream { +fn mk_patch_to_json(_fields: Vec) -> TokenStream { quote! { unimplemented!(); } } diff --git a/crates/models/Cargo.toml b/crates/models/Cargo.toml index 2e40d30c..da90d79a 100644 --- a/crates/models/Cargo.toml +++ b/crates/models/Cargo.toml @@ -9,5 +9,7 @@ model_macros = { path = "../model_macros" } sea-query = "0.32.1" serde = { workspace = true } serde_json = { workspace = true, features = ["preserve_order"] } -sqlx = { workspace = true, default-features = false, features = ["chrono"] } +# in theory we want to default-features = false for sqlx +# but cargo doesn't seem to support this +sqlx = { workspace = true, features = ["chrono"] } uuid = { workspace = true }