aboutsummaryrefslogtreecommitdiff
path: root/src/get_routes.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-07-27 15:22:26 +0200
committerMartin Fischer <martin@push-f.com>2022-07-27 15:23:28 +0200
commit2d9d1f7fa444204a9045f08e19af763f465af383 (patch)
treef29061a67ffc1ceb1b9b802bdd75f46942d302ab /src/get_routes.rs
parent98b0f80bdd1a0d5cebabf093651f66623a39cbd9 (diff)
refactor: remove needless borrows / returns
Diffstat (limited to 'src/get_routes.rs')
-rw-r--r--src/get_routes.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/get_routes.rs b/src/get_routes.rs
index 95d535d..112cf6b 100644
--- a/src/get_routes.rs
+++ b/src/get_routes.rs
@@ -107,7 +107,7 @@ fn edit_blob<C: Controller>(
}
let blob = ctx.repo.find_blob(entr.id()).unwrap();
if let Ok(text) = from_utf8(blob.content()) {
- return Ok(forms::edit_text_form(
+ Ok(forms::edit_text_form(
&forms::EditForm {
text: text.to_string(),
oid: Some(entr.id().to_string()),
@@ -118,7 +118,7 @@ fn edit_blob<C: Controller>(
&ctx,
parts,
)
- .into());
+ .into())
} else {
Ok(forms::upload_form(true, controller, &ctx, parts).into())
}
@@ -144,14 +144,14 @@ fn log_blob<C: Controller>(
walk.push(branch_head.id())?;
let mut prev_commit = branch_head;
- let mut prev_blobid = Some(prev_commit.tree()?.get_path(&ctx.path.as_ref())?.id());
+ let mut prev_blobid = Some(prev_commit.tree()?.get_path(ctx.path.as_ref())?.id());
let mut commits = Vec::new();
// TODO: paginate
for oid in walk.flatten().skip(1) {
let commit = ctx.repo.find_commit(oid)?;
- if let Ok(entr) = commit.tree()?.get_path(&ctx.path.as_ref()) {
+ if let Ok(entr) = commit.tree()?.get_path(ctx.path.as_ref()) {
let blobid = entr.id();
if Some(blobid) != prev_blobid {
commits.push(prev_commit);
@@ -166,7 +166,7 @@ fn log_blob<C: Controller>(
prev_blobid = None;
}
}
- if prev_commit.parent_count() == 0 && prev_commit.tree()?.get_path(&ctx.path.as_ref()).is_ok() {
+ if prev_commit.parent_count() == 0 && prev_commit.tree()?.get_path(ctx.path.as_ref()).is_ok() {
// the very first commit of the branch
commits.push(prev_commit);
}
@@ -249,7 +249,7 @@ fn diff_blob<C: Controller>(
commit.parents().next()
};
- let blob_id = if let Ok(entry) = commit.tree()?.get_path(&ctx.path.as_ref()) {
+ let blob_id = if let Ok(entry) = commit.tree()?.get_path(ctx.path.as_ref()) {
entry.id()
} else {
return Ok(Page {
@@ -262,7 +262,7 @@ fn diff_blob<C: Controller>(
};
let old_blob_id = old_commit
- .and_then(|p| p.tree().unwrap().get_path(&ctx.path.as_ref()).ok())
+ .and_then(|p| p.tree().unwrap().get_path(ctx.path.as_ref()).ok())
.map(|e| e.id());
if Some(blob_id) == old_blob_id {
@@ -301,7 +301,7 @@ fn diff_blob<C: Controller>(
} else {
page.body.push_str(&diff(
"",
- from_utf8(&ctx.repo.find_blob(blob_id)?.content())?,
+ from_utf8(ctx.repo.find_blob(blob_id)?.content())?,
));
}
page.body.push_str("</div>");