Fix parts of CI (#304)

* Run cargo fmt, hide clippy::cmp_owned errors

* Bump deps

* Fix failing test

* Update src/client.rs

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
This commit is contained in:
Nolan Poe 2024-10-31 19:50:50 -07:00 committed by GitHub
parent a96894c743
commit d17d097b12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 312 additions and 449 deletions

736
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]
// CRATES
use crate::client::json;
use crate::config::get_setting;

View File

@ -55,14 +55,14 @@ async fn main() {
let initial = format!("/r/{sub}/{sort}.json?&raw_json=1");
let (mut posts, mut after) = Post::fetch(&initial, false).await.unwrap();
while posts.len() < final_count {
print!("\r");
print!("\r");
let path = format!("/r/{sub}/{sort}.json?sort={sort}&t=&after={after}&raw_json=1");
let (new_posts, new_after) = Post::fetch(&path, false).await.unwrap();
posts.extend(new_posts);
after = new_after;
// Print number of posts fetched
print!("Fetched {} posts", posts.len());
std::io::stdout().flush().unwrap();
std::io::stdout().flush().unwrap();
}
match format {

View File

@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]
// CRATES
use crate::utils::{self, catch_random, error, filter_posts, format_num, format_url, get_filters, param, redirect, setting, template, val, Post, Preferences};
use crate::{

View File

@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(clippy::cmp_owned)]
use brotli::enc::{BrotliCompress, BrotliEncoderParams};
use cached::proc_macro::cached;
@ -195,6 +196,12 @@ impl Route<'_> {
}
}
impl Default for Server {
fn default() -> Self {
Self::new()
}
}
impl Server {
pub fn new() -> Self {
Self {
@ -723,7 +730,7 @@ mod tests {
CompressionType::Brotli => Box::new(BrotliDecompressor::new(body_cursor, expected_lorem_ipsum.len())),
_ => panic!("no decompressor for {}", expected_encoding.to_string()),
_ => panic!("no decompressor for {}", expected_encoding),
};
let mut decompressed = Vec::<u8>::new();

View File

@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]
use std::collections::HashMap;
// CRATES

View File

@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]
use crate::{config, utils};
// CRATES
use crate::utils::{

View File

@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]
// CRATES
use crate::client::json;
use crate::server::RequestExt;

View File

@ -1,4 +1,6 @@
#![allow(dead_code)]
#![allow(clippy::cmp_owned)]
use crate::config::{self, get_setting};
//
// CRATES