mirror of
https://github.com/mikedilger/chorus.git
synced 2026-08-31 07:31:01 +00:00
clippy fixes
This commit is contained in:
parent
01490ea612
commit
5fab8c71e0
@ -2,7 +2,7 @@ use chorus::error::{ChorusError, Error};
|
||||
use pocket_types::{Filter, Id, Pubkey, Tags};
|
||||
use std::env;
|
||||
|
||||
const USAGE: &'static str = "usage: chorus_cmd <config_path> <command> [args...]";
|
||||
const USAGE: &str = "usage: chorus_cmd <config_path> <command> [args...]";
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
// Get args (config path)
|
||||
@ -49,8 +49,8 @@ fn main() -> Result<(), Error> {
|
||||
let (_, tags) = Tags::from_json(b"[]", &mut tags_buffer)?;
|
||||
let mut filter_buffer: [u8; 128] = [0; 128];
|
||||
let filter =
|
||||
Filter::from_parts(&[], &[pk], &[], &tags, None, None, None, &mut filter_buffer)?;
|
||||
let events = store.find_events(&filter, true, 0, 0, |_| true)?;
|
||||
Filter::from_parts(&[], &[pk], &[], tags, None, None, None, &mut filter_buffer)?;
|
||||
let events = store.find_events(filter, true, 0, 0, |_| true)?;
|
||||
for event in events.iter() {
|
||||
store.remove_event(event.id())?;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ fn main() -> Result<(), Error> {
|
||||
chorus::setup_logging(&config);
|
||||
|
||||
// These kinds don't need approval:
|
||||
let allowed_kinds = vec![
|
||||
let allowed_kinds = [
|
||||
Kind::from(4), // Encrypted Direct Message
|
||||
Kind::from(1059), // Giftwrap
|
||||
Kind::from(10002), // Relay list
|
||||
|
||||
@ -397,7 +397,7 @@ impl WebSocketService {
|
||||
self.websocket.close(Some(close_frame)).await?;
|
||||
|
||||
// Drive to completion
|
||||
while let Some(_) = self.websocket.next().await {}
|
||||
while (self.websocket.next().await).is_some() {}
|
||||
|
||||
Err(error)
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
use pocket_types::{Event, Hll8, Id};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum NostrReplyPrefix {
|
||||
None,
|
||||
AuthRequired,
|
||||
@ -29,6 +30,8 @@ impl fmt::Display for NostrReplyPrefix {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum NostrReply<'a> {
|
||||
Auth(String),
|
||||
Event(&'a str, &'a Event),
|
||||
|
||||
@ -125,7 +125,7 @@ pub async fn handle_hash(
|
||||
if let Some(etags) = request.headers().get(IF_MATCH) {
|
||||
let mut onematch: bool = false;
|
||||
for part in etags.to_str()?.split(',') {
|
||||
if &part[1..part.len() - 1] == &format!("{}", hash) {
|
||||
if part[1..part.len() - 1] == format!("{}", hash) {
|
||||
onematch = true;
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ pub async fn handle_hash(
|
||||
let mut send_not_modified: bool = false;
|
||||
if let Some(etags) = request.headers().get(IF_NONE_MATCH) {
|
||||
for part in etags.to_str()?.split(',') {
|
||||
if &part[1..part.len() - 1] == &format!("{}", hash) {
|
||||
if part[1..part.len() - 1] == format!("{}", hash) {
|
||||
send_not_modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ pub async fn check_auth(request: Request<Incoming>) -> Result<Value, Error> {
|
||||
|
||||
// Authorization header must be type "nostr"
|
||||
let value = String::from_utf8(authz.as_bytes().to_owned())?;
|
||||
let mut parts = value.split(|b| b == ' ');
|
||||
let mut parts = value.split(' ');
|
||||
match parts.next() {
|
||||
Some(s) => {
|
||||
if s.to_lowercase() != "nostr" {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user