mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-03 15:33:13 +03:00
Merge pull request #1401 from gitbutlerapp/Fix-casts-and-types
refactor: update type conversions and remove unnecessary clippy lints
This commit is contained in:
commit
261ba4bf38
@ -138,8 +138,14 @@ impl From<git2::IndexEntry> for IndexEntry {
|
||||
impl From<IndexEntry> for git2::IndexEntry {
|
||||
fn from(entry: IndexEntry) -> Self {
|
||||
Self {
|
||||
ctime: git2::IndexTime::new(entry.ctime.seconds() as i32, entry.ctime.nanoseconds()),
|
||||
mtime: git2::IndexTime::new(entry.mtime.seconds() as i32, entry.mtime.nanoseconds()),
|
||||
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(),
|
||||
),
|
||||
dev: entry.dev,
|
||||
ino: entry.ino,
|
||||
mode: entry.mode,
|
||||
|
@ -77,7 +77,6 @@
|
||||
)]
|
||||
//TODO: should probably be cleaned up as any of these could lead to panics or unexpected behaviour (the cast-ones)
|
||||
#![allow(
|
||||
clippy::cast_possible_truncation,
|
||||
clippy::cast_sign_loss,
|
||||
clippy::cast_lossless,
|
||||
clippy::match_same_arms,
|
||||
|
@ -79,6 +79,6 @@ mod tests {
|
||||
});
|
||||
let mut data_file = OpenOptions::new().read(true).open(data_path).unwrap();
|
||||
let value = data_file.read_u32::<LittleEndian>().unwrap();
|
||||
assert_eq!(value, num_threads as u32);
|
||||
assert_eq!(value, u32::try_from(num_threads).unwrap());
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ pub struct BaseBranch {
|
||||
pub remote_url: String,
|
||||
pub base_sha: String,
|
||||
pub current_sha: String,
|
||||
pub behind: u32,
|
||||
pub behind: usize,
|
||||
pub upstream_commits: Vec<RemoteCommit>,
|
||||
pub recent_commits: Vec<RemoteCommit>,
|
||||
}
|
||||
@ -485,7 +485,7 @@ pub fn target_to_base_branch(
|
||||
remote_url: target.remote_url.clone(),
|
||||
base_sha: target.sha.to_string(),
|
||||
current_sha: oid.to_string(),
|
||||
behind: upstream_commits.len() as u32,
|
||||
behind: upstream_commits.len(),
|
||||
upstream_commits,
|
||||
recent_commits,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user