Clippy fixes

This commit is contained in:
Kieran 2024-08-30 19:50:09 +01:00
parent 1a1d85b898
commit ab4ff7b035
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
4 changed files with 7 additions and 7 deletions

View File

@ -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<Self, Self::Error> {
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"));
}

View File

@ -20,7 +20,7 @@ impl<'r> FromRequest<'r> for Nip98Auth {
async fn from_request(request: &'r Request<'_>) -> Outcome<Self, Self::Error> {
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 {

View File

@ -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);

View File

@ -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;