diff --git a/src/auth/blossom.rs b/src/auth/blossom.rs index df09014..8025f14 100644 --- a/src/auth/blossom.rs +++ b/src/auth/blossom.rs @@ -1,6 +1,6 @@ use base64::prelude::*; use log::info; -use nostr::{Event, JsonUtil, Kind, Tag, TagKind, Timestamp}; +use nostr::{Event, JsonUtil, Kind, TagKind, Timestamp}; use rocket::http::Status; use rocket::request::{FromRequest, Outcome}; use rocket::{async_trait, Request}; @@ -17,7 +17,7 @@ impl<'r> FromRequest<'r> for BlossomAuth { async fn from_request(request: &'r Request<'_>) -> Outcome { if let Some(auth) = request.headers().get_one("authorization") { if auth.starts_with("Nostr ") { - let event = if let Ok(j) = BASE64_STANDARD.decode(auth[6..].to_string()) { + let event = if let Ok(j) = BASE64_STANDARD.decode(&auth[6..]) { if let Ok(ev) = Event::from_json(j) { ev } else { @@ -51,7 +51,7 @@ impl<'r> FromRequest<'r> for BlossomAuth { return Outcome::Error((Status::new(401), "Missing expiration tag")); } - if let Err(_) = event.verify() { + if event.verify().is_err() { return Outcome::Error((Status::new(401), "Event signature invalid")); } diff --git a/src/auth/nip98.rs b/src/auth/nip98.rs index 837a41e..46062e4 100644 --- a/src/auth/nip98.rs +++ b/src/auth/nip98.rs @@ -20,7 +20,7 @@ impl<'r> FromRequest<'r> for Nip98Auth { async fn from_request(request: &'r Request<'_>) -> Outcome { return if let Some(auth) = request.headers().get_one("authorization") { if auth.starts_with("Nostr ") { - let event = if let Ok(j) = BASE64_STANDARD.decode(auth[6..].to_string()) { + let event = if let Ok(j) = BASE64_STANDARD.decode(&auth[6..]) { if let Ok(ev) = Event::from_json(j) { ev } else { diff --git a/src/processing/webp.rs b/src/processing/webp.rs index 5c46051..54ccf98 100644 --- a/src/processing/webp.rs +++ b/src/processing/webp.rs @@ -50,7 +50,7 @@ impl WebpProcessor { av_packet_rescale_ts(pkt, (*in_stream).time_base, (*out_stream).time_base); let dec_ctx = self.decoders.get_mut(&idx).expect("Missing decoder config"); - let enc_ctx = self.encoders.get_mut(&out_idx).expect("Missing encoder config"); + let enc_ctx = self.encoders.get_mut(out_idx).expect("Missing encoder config"); let ret = avcodec_send_packet(*dec_ctx, pkt); if ret < 0 { @@ -67,7 +67,7 @@ impl WebpProcessor { return Err(Error::msg("Frame read error")); } - let frame_out = match self.scalers.get_mut(&out_idx) { + let frame_out = match self.scalers.get_mut(out_idx) { Some(sws) => { av_frame_copy_props(frame_out, frame); let ret = sws_scale_frame(*sws, frame_out, frame); diff --git a/src/routes/blossom.rs b/src/routes/blossom.rs index 0e5e893..754cc5a 100644 --- a/src/routes/blossom.rs +++ b/src/routes/blossom.rs @@ -2,7 +2,7 @@ use std::fs; use log::error; use nostr::prelude::hex; -use nostr::{Tag, TagKind}; +use nostr::TagKind; use rocket::data::ByteUnit; use rocket::http::Status; use rocket::response::Responder;