From 5045a4b1c293f61e8f22cc4cd81d87f25517bd5f Mon Sep 17 00:00:00 2001 From: Francisco Gouveia Date: Mon, 27 Jul 2026 13:33:22 +0100 Subject: [PATCH] chore: remove redundant casts --- src/apply.rs | 1 - src/config.rs | 2 +- src/diff.rs | 1 - src/email.rs | 1 - src/time.rs | 4 ++-- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/apply.rs b/src/apply.rs index 0f858e904f..45ee1acc37 100644 --- a/src/apply.rs +++ b/src/apply.rs @@ -102,7 +102,6 @@ impl<'cb> ApplyOptions<'cb> { } fn flag(&mut self, opt: raw::git_apply_flags_t, val: bool) -> &mut Self { - let opt = opt as u32; if val { self.raw.flags |= opt; } else { diff --git a/src/config.rs b/src/config.rs index 1cb95e278a..f593f9e611 100644 --- a/src/config.rs +++ b/src/config.rs @@ -196,7 +196,7 @@ impl Config { /// level. A higher level means a higher priority. The first occurrence of /// the variable will be returned here. pub fn get_bool(&self, name: &str) -> Result { - let mut out = 0 as libc::c_int; + let mut out = 0; let name = CString::new(name)?; unsafe { try_call!(raw::git_config_get_bool(&mut out, &*self.raw, name)); diff --git a/src/diff.rs b/src/diff.rs index 65fbb51260..e5653cfc80 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -709,7 +709,6 @@ impl DiffOptions { } fn flag(&mut self, opt: raw::git_diff_option_t, val: bool) -> &mut DiffOptions { - let opt = opt as u32; if val { self.raw.flags |= opt; } else { diff --git a/src/email.rs b/src/email.rs index 4f87e056f1..40084f7d20 100644 --- a/src/email.rs +++ b/src/email.rs @@ -51,7 +51,6 @@ impl EmailCreateOptions { } fn flag(&mut self, opt: raw::git_email_create_flags_t, val: bool) -> &mut Self { - let opt = opt as u32; if val { self.raw.flags |= opt; } else { diff --git a/src/time.rs b/src/time.rs index 46b5bd3f94..03b77e399a 100644 --- a/src/time.rs +++ b/src/time.rs @@ -31,12 +31,12 @@ impl Time { /// Return the time, in seconds, from epoch pub fn seconds(&self) -> i64 { - self.raw.time as i64 + self.raw.time } /// Return the timezone offset, in minutes pub fn offset_minutes(&self) -> i32 { - self.raw.offset as i32 + self.raw.offset } /// Return whether the offset was positive or negative. Primarily useful