rust 1.84 update

This commit is contained in:
extrawurst 2025-01-09 17:38:44 +01:00
parent 27e28d5f51
commit 66af52ae70
11 changed files with 13 additions and 19 deletions

View file

@ -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
})

View file

@ -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()?;

View file

@ -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)

View file

@ -634,8 +634,7 @@ impl CommitList {
) => details
.upstream
.as_ref()
.map_or(
false,
.is_some_and(
|upstream| {
upstream.reference == remote_branch.reference
},

View file

@ -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;

View file

@ -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;
@ -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,
@ -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,

View file

@ -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,

View file

@ -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)

View file

@ -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)
}
///

View file

@ -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 =

View file

@ -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)