mirror of https://github.com/spikecodes/libreddit
Formatting + clippy changes (#12)
Co-authored-by: Matthew Esposito <matt@matthew.science>
This commit is contained in:
parent
238ef73ed4
commit
a0db2144a5
|
@ -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();
|
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http1().build();
|
||||||
|
|
||||||
// Build the hyper client from the HTTPS connector.
|
// 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);
|
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();
|
let https = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build();
|
||||||
|
|
||||||
// Construct the hyper client from the HTTPS connector.
|
// 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
|
// Build request
|
||||||
let builder = Request::builder()
|
let builder = Request::builder()
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl Route<'_> {
|
||||||
|
|
||||||
impl Server {
|
impl Server {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Server {
|
Self {
|
||||||
default_headers: HeaderMap::new(),
|
default_headers: HeaderMap::new(),
|
||||||
router: Router::new(),
|
router: Router::new(),
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ impl Server {
|
||||||
let headers = default_headers.clone();
|
let headers = default_headers.clone();
|
||||||
|
|
||||||
// Remove double slashes and decode encoded slashes
|
// 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
|
// Remove trailing slashes
|
||||||
if path != "/" && path.ends_with('/') {
|
if path != "/" && path.ends_with('/') {
|
||||||
|
|
|
@ -257,11 +257,7 @@ pub async fn subscriptions_filters(req: Request<Body>) -> Result<Response<Body>,
|
||||||
|
|
||||||
// Redirect back to subreddit
|
// Redirect back to subreddit
|
||||||
// check for redirect parameter if unsubscribing/unfiltering from outside sidebar
|
// check for redirect parameter if unsubscribing/unfiltering from outside sidebar
|
||||||
let path = if let Some(redirect_path) = param(&format!("?{}", query), "redirect") {
|
let path = param(&format!("?{}", query), "redirect").map_or_else(|| format!("/r/{}", sub), |redirect_path| format!("/{}", redirect_path));
|
||||||
format!("/{}", redirect_path)
|
|
||||||
} else {
|
|
||||||
format!("/r/{}", sub)
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut response = redirect(path);
|
let mut response = redirect(path);
|
||||||
|
|
||||||
|
|
|
@ -469,7 +469,7 @@ impl Preferences {
|
||||||
let mut themes = vec!["system".to_string()];
|
let mut themes = vec!["system".to_string()];
|
||||||
for file in ThemeAssets::iter() {
|
for file in ThemeAssets::iter() {
|
||||||
let chunks: Vec<&str> = file.as_ref().split(".css").collect();
|
let chunks: Vec<&str> = file.as_ref().split(".css").collect();
|
||||||
themes.push(chunks[0].to_owned())
|
themes.push(chunks[0].to_owned());
|
||||||
}
|
}
|
||||||
Self {
|
Self {
|
||||||
available_themes: themes,
|
available_themes: themes,
|
||||||
|
|
Loading…
Reference in New Issue