Skip to content

Commit

Permalink
Fix parts of CI (#304)
Browse files Browse the repository at this point in the history
* Run cargo fmt, hide clippy::cmp_owned errors

* Bump deps

* Fix failing test

* Update src/client.rs

---------

Co-authored-by: Matthew Esposito <[email protected]>
  • Loading branch information
np22-jpg and sigaloid authored Nov 1, 2024
1 parent a96894c commit d17d097
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 444 deletions.
726 changes: 285 additions & 441 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/post.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]

// CRATES
use crate::client::json;
use crate::config::get_setting;
Expand Down
4 changes: 2 additions & 2 deletions src/scraper/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/search.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
9 changes: 8 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(clippy::cmp_owned)]

use brotli::enc::{BrotliCompress, BrotliEncoderParams};
use cached::proc_macro::cached;
Expand Down Expand Up @@ -195,6 +196,12 @@ impl Route<'_> {
}
}

impl Default for Server {
fn default() -> Self {
Self::new()
}
}

impl Server {
pub fn new() -> Self {
Self {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]

use std::collections::HashMap;

// CRATES
Expand Down
2 changes: 2 additions & 0 deletions src/subreddit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]

use crate::{config, utils};
// CRATES
use crate::utils::{
Expand Down
2 changes: 2 additions & 0 deletions src/user.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::cmp_owned)]

// CRATES
use crate::client::json;
use crate::server::RequestExt;
Expand Down
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![allow(dead_code)]
#![allow(clippy::cmp_owned)]

use crate::config::{self, get_setting};
//
// CRATES
Expand Down

0 comments on commit d17d097

Please sign in to comment.