Skip to content

Commit

Permalink
rust 1.84 update
Browse files Browse the repository at this point in the history
  • Loading branch information
extrawurst committed Jan 9, 2025
1 parent 27e28d5 commit 66af52a
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion asyncgit/src/sync/hunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn stage_hunk(

let mut opt = ApplyOptions::new();
opt.hunk_callback(|hunk| {
hunk.map_or(false, |hunk| {
hunk.is_some_and(|hunk| {
let header = HunkHeader::from(hunk);
hash(&header) == hunk_hash
})
Expand Down
2 changes: 1 addition & 1 deletion asyncgit/src/sync/staging/stage_tracked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn stage_lines(
let blob_id = repo.blob(new_content.as_bytes())?;

idx.id = blob_id;
idx.file_size = u32::try_conv(new_content.as_bytes().len())?;
idx.file_size = u32::try_conv(new_content.len())?;
index.add(&idx)?;

index.write()?;
Expand Down
2 changes: 1 addition & 1 deletion filetreelist/src/filetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl FileTree {

///
pub fn move_selection(&mut self, dir: MoveSelection) -> bool {
self.selection.map_or(false, |selection| {
self.selection.is_some_and(|selection| {
let new_index = match dir {
MoveSelection::Up => {
self.selection_updown(selection, true)
Expand Down
3 changes: 1 addition & 2 deletions src/components/commitlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,7 @@ impl CommitList {
) => details
.upstream
.as_ref()
.map_or(
false,
.is_some_and(
|upstream| {
upstream.reference == remote_branch.reference
},
Expand Down
4 changes: 1 addition & 3 deletions src/components/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ impl DiffComponent {

for (i, hunk) in diff.hunks.iter().enumerate() {
let hunk_selected = self.focused()
&& self
.selected_hunk
.map_or(false, |s| s == i);
&& self.selected_hunk.is_some_and(|s| s == i);

if lines_added >= height as usize {
break;
Expand Down
6 changes: 3 additions & 3 deletions src/components/revision_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl RevisionFilesComponent {
self.show()?;

let same_id =
self.revision.as_ref().map_or(false, |c| c.id == commit);
self.revision.as_ref().is_some_and(|c| c.id == commit);

if !same_id {
self.files = None;
Expand Down Expand Up @@ -187,7 +187,7 @@ impl RevisionFilesComponent {
}

fn blame(&self) -> bool {
self.selected_file_path().map_or(false, |path| {
self.selected_file_path().is_some_and(|path| {
self.queue.push(InternalEvent::OpenPopup(
StackablePopupOpen::BlameFile(BlameFileOpen {
file_path: path,
Expand All @@ -201,7 +201,7 @@ impl RevisionFilesComponent {
}

fn file_history(&self) -> bool {
self.selected_file_path().map_or(false, |path| {
self.selected_file_path().is_some_and(|path| {
self.queue.push(InternalEvent::OpenPopup(
StackablePopupOpen::FileRevlog(FileRevOpen::new(
path,
Expand Down
2 changes: 1 addition & 1 deletion src/components/status_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl StatusTreeComponent {

///
pub fn is_file_selected(&self) -> bool {
self.tree.selected_item().map_or(false, |item| {
self.tree.selected_item().is_some_and(|item| {
match item.kind {
FileTreeItemKind::File(_) => true,
FileTreeItemKind::Path(..) => false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/statustree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl StatusTree {

///
pub fn move_selection(&mut self, dir: MoveSelection) -> bool {
self.selection.map_or(false, |selection| {
self.selection.is_some_and(|selection| {
let selection_change = match dir {
MoveSelection::Up => {
self.selection_updown(selection, true)
Expand Down
5 changes: 1 addition & 4 deletions src/popups/file_revlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ impl FileRevlogPopup {
///
pub fn any_work_pending(&self) -> bool {
self.git_diff.is_pending()
|| self
.git_log
.as_ref()
.map_or(false, AsyncLog::is_pending)
|| self.git_log.as_ref().is_some_and(AsyncLog::is_pending)
}

///
Expand Down
2 changes: 1 addition & 1 deletion src/popups/fuzzy_find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl FuzzyFindPopup {
.map(|(idx, indices)| {
let selected = self
.selected_index
.map_or(false, |index| index == *idx);
.is_some_and(|index| index == *idx);
let full_text =
trim_length_left(&self.contents[*idx], width);
let trim_length =
Expand Down
2 changes: 1 addition & 1 deletion src/popups/taglist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ impl TagListPopup {
let is_tag_missing_on_remote = self
.missing_remote_tags
.as_ref()
.map_or(false, |missing_remote_tags| {
.is_some_and(|missing_remote_tags| {
let remote_tag = format!("refs/tags/{}", tag.name);

missing_remote_tags.contains(&remote_tag)
Expand Down

0 comments on commit 66af52a

Please sign in to comment.