clippy ftw
This commit is contained in:
parent
ed0c277c4b
commit
cffd91bd5d
3 changed files with 8 additions and 8 deletions
|
@ -38,7 +38,7 @@ impl Log for SocialRepo {
|
|||
|
||||
Ok(Box::new(
|
||||
git_revwalk
|
||||
.filter_map(move |idres| idres.map(|id| self.repo.find_commit(id.clone())).ok())
|
||||
.filter_map(move |idres| idres.map(|id| self.repo.find_commit(id)).ok())
|
||||
.flatten()
|
||||
.map(|c| c.into())
|
||||
.map(move |c: SocialCommit| if short { c.oneline() } else { c })
|
||||
|
@ -59,7 +59,7 @@ impl Log for SocialRepo {
|
|||
revwalk.set_sorting(git2::Sort::REVERSE | git2::Sort::TOPOLOGICAL)?;
|
||||
revwalk.push_head()?;
|
||||
revwalk
|
||||
.filter_map(move |idres| idres.map(|id| self.repo.find_commit(id.clone())).ok())
|
||||
.filter_map(move |idres| idres.map(|id| self.repo.find_commit(id)).ok())
|
||||
.take(1)
|
||||
.next()
|
||||
.map(|r| {
|
||||
|
@ -69,7 +69,7 @@ impl Log for SocialRepo {
|
|||
.map(|c| c.into())
|
||||
})
|
||||
.ok_or(SocialError {
|
||||
message: format!("Repo doesn't contain any commits!")
|
||||
message: "Repo doesn't contain any commits!".to_string()
|
||||
})?
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ pub struct SocialRepo {
|
|||
pub repo: Repository,
|
||||
}
|
||||
|
||||
impl<'repo> SocialRepo {
|
||||
impl SocialRepo {
|
||||
pub fn new(path: &str) -> Result<Self, SocialError> {
|
||||
Repository::open(path)
|
||||
.map(|repo| Self { repo })
|
||||
|
|
|
@ -25,7 +25,7 @@ impl LsTree for SocialRepo {
|
|||
self.get_tree(rev)?
|
||||
} else {
|
||||
self.get_tree(rev)
|
||||
.and_then(|t| t.get_path(&path))
|
||||
.and_then(|t| t.get_path(path))
|
||||
.and_then(|entry: TreeEntry| self.repo.find_tree(entry.id()))?
|
||||
};
|
||||
|
||||
|
@ -37,9 +37,9 @@ impl LsTree for SocialRepo {
|
|||
self.repo
|
||||
.revparse_single(&format!("{}", entry.id()))
|
||||
.map(|obj: Object| {
|
||||
obj.as_blob().map(|b: &Blob| {
|
||||
if let Some(b) = obj.as_blob() {
|
||||
files.push(into_social_tree_entry(entry, b.content().len()))
|
||||
});
|
||||
};
|
||||
})
|
||||
.unwrap_or(());
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ impl LsTree for SocialRepo {
|
|||
|
||||
fn show_file(&self, rev: &str, path: &Path) -> Result<SocialFileContent, SocialError> {
|
||||
self.get_tree(rev)
|
||||
.and_then(|t| t.get_path(&path))
|
||||
.and_then(|t| t.get_path(path))
|
||||
.and_then(|entry: TreeEntry| match entry.kind() {
|
||||
Some(ObjectType::Blob) => self
|
||||
.repo
|
||||
|
|
Loading…
Add table
Reference in a new issue