cargo-fmt the src
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
parent
ce001c6a79
commit
78b4213c62
|
@ -0,0 +1,2 @@
|
|||
max_width = 79
|
||||
reorder_imports = true
|
|
@ -44,7 +44,8 @@ fn rocket() -> _ {
|
|||
let args = get_parsed_args();
|
||||
|
||||
// create the upload directory, if not already created
|
||||
fs::create_dir_all(args.upload).expect("Could not create the upload directory");
|
||||
fs::create_dir_all(args.upload)
|
||||
.expect("Could not create the upload directory");
|
||||
|
||||
rocket::build()
|
||||
.mount(
|
||||
|
|
|
@ -8,7 +8,8 @@ use syntect::parsing::SyntaxSet;
|
|||
pub fn get_pretty_body(path: &PathBuf, ext: &String) -> String {
|
||||
let ss = SyntaxSet::load_defaults_newlines();
|
||||
|
||||
let mut theme_cursor = std::io::Cursor::new(include_bytes!("../../themes/ayu_dark.tmTheme"));
|
||||
let mut theme_cursor =
|
||||
std::io::Cursor::new(include_bytes!("../../themes/ayu_dark.tmTheme"));
|
||||
let theme = ThemeSet::load_from_reader(&mut theme_cursor).unwrap();
|
||||
|
||||
let content = fs::read_to_string(path).unwrap();
|
||||
|
|
|
@ -8,7 +8,9 @@ use crate::models::pretty::get_pretty_body;
|
|||
use crate::models::pretty_syntax::PasteIdSyntax;
|
||||
|
||||
#[get("/p/<id_ext>", rank = 1)]
|
||||
pub async fn pretty_retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<Template> {
|
||||
pub async fn pretty_retrieve_ext(
|
||||
id_ext: PasteIdSyntax<'_>,
|
||||
) -> Option<Template> {
|
||||
let id = id_ext.get_fname();
|
||||
let ext = id_ext.get_ext();
|
||||
|
||||
|
|
|
@ -16,5 +16,6 @@ pub async fn retrieve(id: PasteId<'_>) -> Option<File> {
|
|||
pub async fn retrieve_ext(id_ext: PasteIdSyntax<'_>) -> Option<File> {
|
||||
// let filename = format!("upload/{id}", id = id_ext.get_fname());
|
||||
|
||||
File::open(get_upload_dir().join(format!("{id}", id = id_ext.get_fname()))).ok()
|
||||
File::open(get_upload_dir().join(format!("{id}", id = id_ext.get_fname())))
|
||||
.ok()
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ use std::{borrow::Cow, ffi::OsStr, path::PathBuf};
|
|||
struct Static;
|
||||
|
||||
#[get("/static/<file..>")]
|
||||
pub fn static_files(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> {
|
||||
pub fn static_files(
|
||||
file: PathBuf,
|
||||
) -> Option<(ContentType, Cow<'static, [u8]>)> {
|
||||
let filename = file.display().to_string();
|
||||
let asset = Static::get(&filename)?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue