Formatting + clippy changes (#12)

Co-authored-by: Matthew Esposito <matt@matthew.science>
This commit is contained in:
Matt 2022-09-24 22:19:13 -04:00 committed by GitHub
parent 238ef73ed4
commit a0db2144a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 10 deletions

View File

@ -27,7 +27,7 @@ async fn stream(url: &str, req: &Request<Body>) -> Result<Response<Body>, String
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
// Build the hyper client from the HTTPS connector.
let client: client::Client<_, hyper::Body> = client::Client::builder().build(https);
let client: client::Client<_, Body> = client::Client::builder().build(https);
let mut builder = Request::get(uri);
@ -67,7 +67,7 @@ fn request(url: String, quarantine: bool) -> Boxed<Result<Response<Body>, String
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build();
// Construct the hyper client from the HTTPS connector.
let client: client::Client<_, hyper::Body> = client::Client::builder().build(https);
let client: client::Client<_, Body> = client::Client::builder().build(https);
// Build request
let builder = Request::builder()

View File

@ -131,7 +131,7 @@ impl Route<'_> {
impl Server {
pub fn new() -> Self {
Server {
Self {
default_headers: HeaderMap::new(),
router: Router::new(),
}
@ -159,7 +159,7 @@ impl Server {
let headers = default_headers.clone();
// Remove double slashes and decode encoded slashes
let mut path = req.uri().path().replace("//", "/").replace("%2F","/");
let mut path = req.uri().path().replace("//", "/").replace("%2F", "/");
// Remove trailing slashes
if path != "/" && path.ends_with('/') {

View File

@ -257,11 +257,7 @@ pub async fn subscriptions_filters(req: Request<Body>) -> Result<Response<Body>,
// Redirect back to subreddit
// check for redirect parameter if unsubscribing/unfiltering from outside sidebar
let path = if let Some(redirect_path) = param(&format!("?{}", query), "redirect") {
format!("/{}", redirect_path)
} else {
format!("/r/{}", sub)
};
let path = param(&format!("?{}", query), "redirect").map_or_else(|| format!("/r/{}", sub), |redirect_path| format!("/{}", redirect_path));
let mut response = redirect(path);

View File

@ -469,7 +469,7 @@ impl Preferences {
let mut themes = vec!["system".to_string()];
for file in ThemeAssets::iter() {
let chunks: Vec<&str> = file.as_ref().split(".css").collect();
themes.push(chunks[0].to_owned())
themes.push(chunks[0].to_owned());
}
Self {
available_themes: themes,