Merge pull request #2106 from gitbutlerapp/don-t-try-to-cast-from-i32-just-truncate

truncate instead of i32::try_from() when building index entry
This commit is contained in:
Qix 2023-12-19 12:09:52 +01:00 committed by GitHub
commit 2407f8b279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,16 +144,11 @@ impl From<git2::IndexEntry> for IndexEntry {
}
impl From<IndexEntry> for git2::IndexEntry {
#[allow(clippy::cast_possible_truncation)]
fn from(entry: IndexEntry) -> Self {
Self {
ctime: git2::IndexTime::new(
i32::try_from(entry.ctime.seconds()).unwrap(),
entry.ctime.nanoseconds(),
),
mtime: git2::IndexTime::new(
i32::try_from(entry.mtime.seconds()).unwrap(),
entry.mtime.nanoseconds(),
),
ctime: git2::IndexTime::new(entry.ctime.seconds() as i32, entry.ctime.nanoseconds()),
mtime: git2::IndexTime::new(entry.mtime.seconds() as i32, entry.mtime.nanoseconds()),
dev: entry.dev,
ino: entry.ino,
mode: entry.mode,