M src/git/branches.rs => src/git/branches.rs +1 -6
@@ 11,12 11,7 @@ pub fn branches(repo_name: String) -> Option<Vec<Branch>> {
if let Ok(Some(name)) = i.0.name() {
branches.push(Branch {
branch: name.to_string(),
- commit: match get_commits(
- repo_name.clone(),
- 1,
- Some(name.to_string()),
- None,
- ) {
+ commit: match get_commits(repo_name.clone(), 1, Some(name.to_string()), None) {
Some(x) => x.first().cloned(),
None => None,
},
M src/git/commits.rs => src/git/commits.rs +1 -2
@@ 65,8 65,7 @@ pub fn get_commits(
}
}
if allowed {
- let time =
- Duration::seconds(repo_commit.time().seconds() - Utc::now().timestamp());
+ let time = Duration::seconds(repo_commit.time().seconds() - Utc::now().timestamp());
commits.push(Commits {
commit_hash: commit_rev.to_string(),
commit: repo_commit.message().unwrap_or("").to_string(),
M src/git/file.rs => src/git/file.rs +1 -1
@@ 75,7 75,7 @@ pub fn file(repo: String, branch: String, path: String) -> Option<(File, Option<
};
return Some((file, content, blob.content().iter().map(|x| *x).collect()));
}
- _ => None
+ _ => None,
}
}
M src/main.rs => src/main.rs +2 -2
@@ 1,4 1,4 @@
-#![allow(clippy::map_clone)]
+#![allow(clippy::map_clone)]
#[macro_use]
extern crate rocket;
mod clone;
@@ 67,6 67,6 @@ async fn robots() -> Option<rocket::fs::NamedFile> {
async fn favicon() -> Option<rocket::fs::NamedFile> {
let mut path = dirs::config_dir().expect("Could not get the config directory");
path.push("selfhut");
- path.push("favicon.ico");
+ path.push("favicon.ico");
rocket::fs::NamedFile::open(path).await.ok()
}
M src/repository/raw.rs => src/repository/raw.rs +1 -5
@@ 3,11 3,7 @@ use crate::PathBufWithDotfiles;
#[get("/<repo>/blob/<branch>/<location..>", rank = 2)]
pub fn raw(repo: String, branch: String, location: PathBufWithDotfiles) -> Option<Vec<u8>> {
- match file(
- repo,
- branch,
- location.get().display().to_string(),
- ) {
+ match file(repo, branch, location.get().display().to_string()) {
Some(file) => Some(file.2),
None => None,
}
M src/repository/refs.rs => src/repository/refs.rs +3 -1
@@ 9,7 9,9 @@ use rocket_dyn_templates::{context, Template};
pub fn refs(repo: String, page: Option<usize>) -> Option<Template> {
let mut tags = get_tag(repo.clone(), 10, (page.unwrap_or(1) - 1) * 10, None);
let mut pages = 1;
- if let Some(ref mut x) = tags { pages = x.1 / 10 + 1 }
+ if let Some(ref mut x) = tags {
+ pages = x.1 / 10 + 1
+ }
Some(Template::render(
"repository/refs",
context! {