rustfmt and removal of superfluous constant

master
CptCaptain 3 years ago
parent 58c52e4033
commit 004887799e
  1. 19
      src/main.rs

@ -7,8 +7,8 @@ use std::env;
use std::fmt;
use std::path::Path;
use rocket::request::FromFormValue;
use rocket::http::RawStr;
use rocket::request::FromFormValue;
use rocket::http::uri::Absolute;
use rocket::request::Form;
@ -18,9 +18,9 @@ use std::process::Command;
#[derive(Debug)]
struct Link {
uri: String
uri: String,
}
#[derive(FromForm)]
struct Video {
link: Link,
@ -31,8 +31,8 @@ const LIMIT: u64 = 1024;
impl fmt::Display for Link {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.uri)
}
write!(f, "{}", self.uri)
}
}
impl<'v> FromFormValue<'v> for Link {
@ -42,7 +42,7 @@ impl<'v> FromFormValue<'v> for Link {
// Decode form data into string
let string = match form_value.url_decode() {
Ok(string) => string,
Err(_) => return Err(form_value)
Err(_) => return Err(form_value),
};
// Try to parse a hyperlink from the string
@ -58,8 +58,10 @@ impl<'v> FromFormValue<'v> for Link {
// Check for success
let result = match abs_uri {
Some(abs_uri) => Link{uri: abs_uri.to_string()},
_ => return Err(form_value)
Some(abs_uri) => Link {
uri: abs_uri.to_string(),
},
_ => return Err(form_value),
};
// Return successfully.
@ -67,7 +69,6 @@ impl<'v> FromFormValue<'v> for Link {
}
}
#[post("/new", data = "<video>")]
fn new(video: Form<Video>) -> Redirect {
Command::new("/bin/env")

Loading…
Cancel
Save