Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4924fc6
[Clippy] Address `clippy::missing_safety_doc` in src/apply.rs
DanielEScherzer Jul 14, 2026
2acbfb7
[Clippy] Address `clippy::new_without_default` in src/apply.rs
DanielEScherzer Jul 14, 2026
8d2f956
[Clippy] Address `clippy::redundant_closure` in src/blame.rs
DanielEScherzer Jul 14, 2026
d39ed7b
[Clippy] Address `clippy::io_other_error` in src/blob.rs
DanielEScherzer Jul 14, 2026
b6ea28b
[Clippy] Address `clippy::missing_safety_doc` in src/branch.rs
DanielEScherzer Jul 14, 2026
6278c61
[Clippy] Address `clippy::explicit_auto_deref` in src/buf.rs
DanielEScherzer Jul 14, 2026
b2e1850
[Clippy] Address `clippy::manual_non_exhaustive` in src/build.rs
DanielEScherzer Jul 14, 2026
e2a5755
[Clippy] Address `clippy::missing_safety_doc` in src/build.rs
DanielEScherzer Jul 14, 2026
95fab73
[Clippy] Address `clippy::needless_lifetimes` in src/call.rs
DanielEScherzer Jul 14, 2026
5843bac
[Clippy] Address `clippy::new_without_default` in src/cherrypick.rs
DanielEScherzer Jul 14, 2026
a9aaab1
[Clippy] Address `clippy::redundant_closure` in src/commit.rs
DanielEScherzer Jul 14, 2026
604553a
[Clippy] Address `clippy::should_implement_trait` in src/config.rs
DanielEScherzer Jul 14, 2026
700a9cd
[Clippy] Address `clippy::manual_strip` in src/cred.rs
DanielEScherzer Jul 14, 2026
493cd2f
[Clippy] Address `clippy::match_result_ok` in src/cred.rs
DanielEScherzer Jul 14, 2026
2f79fce
[Clippy] Address `clippy::missing_safety_doc` in src/cred.rs
DanielEScherzer Jul 14, 2026
f96b066
[Clippy] Address `clippy::needless_borrowed_reference` in src/cred.rs
DanielEScherzer Jul 14, 2026
4a235ba
[Clippy] Address `clippy::needless_borrows_for_generic_args` in src/c…
DanielEScherzer Jul 14, 2026
889d37d
[Clippy] Address `clippy::should_implement_trait` in src/cred.rs
DanielEScherzer Jul 14, 2026
bba606e
[Clippy] Address `clippy::empty_docs` in src/diff.rs
DanielEScherzer Jul 14, 2026
d7f4900
[Clippy] Address `clippy::missing_safety_doc` in src/diff.rs
DanielEScherzer Jul 14, 2026
894770c
[Clippy] Address `clippy::new_without_default` in src/diff.rs
DanielEScherzer Jul 14, 2026
2ba47af
[Clippy] Address `clippy::too_many_arguments` in src/email.rs
DanielEScherzer Jul 14, 2026
4a7521a
[Clippy] Address `clippy::should_implement_trait` in src/error.rs
DanielEScherzer Jul 14, 2026
d9cfd2d
[Clippy] Address `clippy::io_other_error` in src/indexer.rs
DanielEScherzer Jul 14, 2026
9fc2de6
[Clippy] Address `clippy::needless_lifetimes` in src/lib.rs
DanielEScherzer Jul 14, 2026
eff593a
[Clippy] Address `clippy::should_implement_trait` in src/lib.rs
DanielEScherzer Jul 14, 2026
abe7300
[Clippy] Address `clippy::missing_safety_doc` in src/merge.rs
DanielEScherzer Jul 14, 2026
50c5ff3
[Clippy] Address `clippy::redundant_closure` in src/merge.rs
DanielEScherzer Jul 14, 2026
ff07f2f
[Clippy] Address `clippy::len_without_is_empty` in src/message.rs
DanielEScherzer Jul 14, 2026
dcbf356
[Clippy] Address `clippy::needless_borrow` in src/message.rs
DanielEScherzer Jul 14, 2026
8cfba67
[Clippy] Address `clippy::redundant_closure` in src/message.rs
DanielEScherzer Jul 14, 2026
65b3df6
[Clippy] Address `clippy::io_error_other` in src/odb.rs
DanielEScherzer Jul 14, 2026
c063ce0
[Clippy] Address `clippy::len_without_is_empty` in src/odb.rs
DanielEScherzer Jul 14, 2026
94dd707
[Clippy] Address `clippy::should_implement_trait` in src/odb.rs
DanielEScherzer Jul 14, 2026
4598f25
[Clippy] Address `clippy::single_match` in src/odb.rs
DanielEScherzer Jul 14, 2026
8bd58e6
[Clippy] Address `clippy::extra_unused_lifetimes` in src/oid_array.rs
DanielEScherzer Jul 14, 2026
1609c60
[Clippy] Address `clippy::should_implement_trait` in src/oid.rs
DanielEScherzer Jul 14, 2026
20a6c6b
[Clippy] Address `clippy::missing_safety_doc` in src/opts.rs
DanielEScherzer Jul 15, 2026
fd5ae26
[Clippy] Address `clippy::redundant_closure` in src/packbuilder.rs
DanielEScherzer Jul 15, 2026
9fc8b06
[Clippy] Address `clippy::len_without_is_empty` in src/rebase.rs
DanielEScherzer Jul 15, 2026
1a7ae6b
[Clippy] Address `clippy::needless_option_take` in src/rebase.rs
DanielEScherzer Jul 15, 2026
3fee76e
[Clippy] Address `clippy::redundant_closure` in src/rebase.rs
DanielEScherzer Jul 15, 2026
70271b9
[Clippy] Address `clippy::redundant_closure` in src/reference.rs
DanielEScherzer Jul 15, 2026
e04e144
[Clippy] Address `clippy::redundant_closure` in src/reflog.rs
DanielEScherzer Jul 15, 2026
d54058a
[Clippy] Address `clippy::derivable_impls` in src/remote.rs
DanielEScherzer Jul 15, 2026
a42b5cc
[Clippy] Address `clippy::empty_line_after_doc_comments` in src/remot…
DanielEScherzer Jul 15, 2026
5937bce
[Clippy] Address `clippy::redundant_closure` in src/remote.rs
DanielEScherzer Jul 15, 2026
e9727fb
[Clippy] Address `clippy::unwrap_or_default` in src/remote.rs
DanielEScherzer Jul 15, 2026
4dee9b9
[Clippy] Address `clippy::doc_overindented_list_items` in src/remote_…
DanielEScherzer Jul 15, 2026
579ebdd
[Clippy] Address `clippy::explicit_auto_deref` in src/repo.rs
DanielEScherzer Jul 15, 2026
01d626b
[Clippy] Address `clippy::missing_safety_doc` in src/repo.rs
DanielEScherzer Jul 15, 2026
51d382a
[Clippy] Address `clippy::needless_borrow` in src/repo.rs
DanielEScherzer Jul 15, 2026
872493f
[Clippy] Address `clippy::new_without_default` in src/repo.rs
DanielEScherzer Jul 15, 2026
cfcf761
[Clippy] Address `clippy::redundant_closure` in src/repo.rs
DanielEScherzer Jul 15, 2026
0d00c84
[Clippy] Address `clippy::too_many_arguments` in src/repo.rs
DanielEScherzer Jul 15, 2026
fe53f31
[Clippy] Address `clippy::zero_ptr` in src/repo.rs
DanielEScherzer Jul 15, 2026
7ed3393
[Clippy] Address `clippy::new_without_default` in src/revert.rs
DanielEScherzer Jul 15, 2026
15815dc
[Clippy] Address `clippy::missing_safety_doc` in src/revert.rs
DanielEScherzer Jul 15, 2026
bf01979
[Clippy] Address `clippy::missing_safety_doc` in src/status.rs
DanielEScherzer Jul 15, 2026
e8a0834
[Clippy] Address `clippy::redundant_closure` in src/string_array.rs
DanielEScherzer Jul 15, 2026
78570ef
[Clippy] Address `clippy::empty_line_after_doc_comments` in src/submo…
DanielEScherzer Jul 15, 2026
c5e2093
[Clippy] Address `clippy::let_and_return` in src/submodule.rs
DanielEScherzer Jul 15, 2026
000ea52
[Clippy] Address `clippy::redundant_closure` in src/submodule.rs
DanielEScherzer Jul 15, 2026
205f3c3
[Clippy] Address `clippy::from_over_into` in src/tag.rs
DanielEScherzer Jul 15, 2026
3003bba
[Clippy] Address `clippy::redundant_closure` in src/tag.rs
DanielEScherzer Jul 15, 2026
de0a19a
[Clippy] Address `clippy::missing_safety_doc` in src/transport.rs
DanielEScherzer Jul 15, 2026
b84b7cb
[Clippy] Address `clippy::missing_transmute_annotations` in src/trans…
DanielEScherzer Jul 15, 2026
d10b756
[Clippy] Address `clippy::from_over_into` in src/tree.rs
DanielEScherzer Jul 15, 2026
9ff0abd
[Clippy] Address `clippy::manual_unwrap_or` in src/tree.rs
DanielEScherzer Jul 15, 2026
df57c81
[Clippy] Address `clippy::missing_safety_doc` in src/util.rs
DanielEScherzer Jul 15, 2026
c028158
[Clippy] Address `clippy::needless_lifetimes` in src/util.rs
DanielEScherzer Jul 15, 2026
5721e99
[Clippy] Address `clippy::needless_range_loop` in src/util.rs
DanielEScherzer Jul 15, 2026
b987823
[Clippy] Address `clippy::needless_return` in src/util.rs
DanielEScherzer Jul 15, 2026
6a59e5c
[Clippy] Address `clippy::new_without_default` in src/worktree.rs
DanielEScherzer Jul 15, 2026
3aedab1
[Clippy] Address `clippy::redundant_closure` in src/worktree.rs
DanielEScherzer Jul 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/apply.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! git_apply support
//! see original: <https://github.com/libgit2/libgit2/blob/master/include/git2/apply.h>

#![allow(clippy::missing_safety_doc)]
#![allow(clippy::new_without_default)]

use crate::{panic, raw, util::Binding, DiffDelta, DiffHunk};
use libc::c_int;
use std::{ffi::c_void, mem};
Expand Down Expand Up @@ -146,11 +143,23 @@ impl<'cb> ApplyOptions<'cb> {
}

/// Pointer to a raw git_stash_apply_options
///
/// # Safety
///
/// The provided pointer must not be used to manipulate the options, and
/// must not outlive the [`ApplyOptions`] instance.
pub unsafe fn raw(&mut self) -> *const raw::git_apply_options {
&self.raw as *const _
}
}

impl<'cb> Default for ApplyOptions<'cb> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually not fond of this. This may not be useful if we don't really need it. And that was why rust-lang/cargo only turn on a subset of lint group https://github.com/rust-lang/cargo/blob/371a35405026fc16dd9968589f13cd746b96e024/Cargo.toml#L139-L145.

Some of them are too pedantic.

/// Creates a new set of empty options (zeroed).
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
#[allow(clippy::needless_borrows_for_generic_args)]
mod tests {
Expand Down
4 changes: 1 addition & 3 deletions src/blame.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::redundant_closure)]

use crate::util::{self, Binding};
use crate::{raw, signature, Error, ErrorClass, ErrorCode, Oid, Repository, Signature};
use libc::c_char;
Expand Down Expand Up @@ -222,7 +220,7 @@ impl<'blame> BlameHunk<'blame> {
/// `Ok(None)` may be returned if there is no summary.
pub fn summary(&self) -> Result<Option<&str>, Error> {
match self.summary_bytes() {
Some(sb) => str::from_utf8(sb).map(|s| Some(s)).map_err(|e| e.into()),
Some(sb) => str::from_utf8(sb).map(Some).map_err(|e| e.into()),
None => Ok(None),
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/blob.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::io_other_error)]

use std::io;
use std::marker;
use std::mem;
Expand Down Expand Up @@ -139,12 +137,12 @@ impl<'repo> io::Write for BlobWriter<'repo> {
if let Some(f) = write_cb {
let res = f(self.raw, buf.as_ptr() as *const _, buf.len());
if res < 0 {
Err(io::Error::new(io::ErrorKind::Other, "Write error"))
Err(io::Error::other("Write error"))
} else {
Ok(buf.len())
}
} else {
Err(io::Error::new(io::ErrorKind::Other, "no write callback"))
Err(io::Error::other("no write callback"))
}
}
fn flush(&mut self) -> io::Result<()> {
Expand Down
7 changes: 4 additions & 3 deletions src/branch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::missing_safety_doc)]

use std::ffi::CString;
use std::marker;
use std::ptr;
Expand Down Expand Up @@ -129,8 +127,11 @@ impl<'repo> Branch<'repo> {
impl<'repo> Branches<'repo> {
/// Creates a new iterator from the raw pointer given.
///
/// # Safety
///
/// This function is unsafe as it is not guaranteed that `raw` is a valid
/// pointer.
/// pointer. The caller must ensure that `raw` is a valid pointer and lives
/// as long as the [`Branches`] object.
pub unsafe fn from_raw(raw: *mut raw::git_branch_iterator) -> Branches<'repo> {
Branches {
raw,
Expand Down
5 changes: 2 additions & 3 deletions src/buf.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::explicit_auto_deref)]

use std::ops::{Deref, DerefMut};
use std::ptr;
use std::slice;
Expand Down Expand Up @@ -38,7 +36,7 @@ impl Buf {

/// Attempt to view this buffer as a string slice.
pub fn as_str(&self) -> Result<&str, Error> {
str::from_utf8(&**self).map_err(|e| e.into())
str::from_utf8(self).map_err(|e| e.into())
}
}

Expand Down Expand Up @@ -78,6 +76,7 @@ impl Drop for Buf {
}

#[test]
#[allow(clippy::explicit_auto_deref)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot in the last PR. we should use #[expect] instead for all #[allow].

fn empty_buf() {
let mut buf = Buf::new();
let x: &[u8] = &*buf;
Expand Down
15 changes: 8 additions & 7 deletions src/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! Builder-pattern objects for configuration various git operations.

#![allow(clippy::manual_non_exhaustive)]
#![allow(clippy::missing_safety_doc)]

use libc::{c_char, c_int, c_uint, c_void, size_t};
use std::ffi::{CStr, CString};
use std::mem;
Expand Down Expand Up @@ -128,6 +125,7 @@ impl<'cb> Default for RepoBuilder<'cb> {

/// Options that can be passed to `RepoBuilder::clone_local`.
#[derive(Clone, Copy)]
#[non_exhaustive]
pub enum CloneLocal {
/// Auto-detect (default)
///
Expand All @@ -143,9 +141,6 @@ pub enum CloneLocal {

/// Bypass the git-aware transport, but don't try to use hardlinks.
NoLinks = raw::GIT_CLONE_LOCAL_NO_LINKS as isize,

#[doc(hidden)]
__Nonexhaustive = 0xff,
}

impl<'cb> RepoBuilder<'cb> {
Expand Down Expand Up @@ -593,8 +588,14 @@ impl<'cb> CheckoutBuilder<'cb> {

/// Configure a raw checkout options based on this configuration.
///
/// # Safety
///
/// This method is unsafe as there is no guarantee that this structure will
/// outlive the provided checkout options.
/// outlive the provided checkout options. The caller must ensure that
/// `opts` does not outlive the [`CheckoutBuilder`], and also that for any
/// fields configured in the `CheckoutBuilder` that are provided to the
/// `opts` as pointers, those pointers are not used if the original
/// references held in the `CheckoutBuilder` are dropped.
pub unsafe fn configure(&mut self, opts: &mut raw::git_checkout_options) {
opts.version = raw::GIT_CHECKOUT_OPTIONS_VERSION;
opts.disable_filters = self.disable_filters as c_int;
Expand Down
5 changes: 2 additions & 3 deletions src/call.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::needless_lifetimes)]
#![macro_use]

use crate::Error;
Expand Down Expand Up @@ -69,12 +68,12 @@ mod impls {
*self as libc::c_int
}
}
impl<'a, T> Convert<*const T> for &'a T {
impl<T> Convert<*const T> for &T {
fn convert(&self) -> *const T {
*self as *const T
}
}
impl<'a, T> Convert<*mut T> for &'a mut T {
impl<T> Convert<*mut T> for &mut T {
fn convert(&self) -> *mut T {
&**self as *const T as *mut T
}
Expand Down
9 changes: 7 additions & 2 deletions src/cherrypick.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::new_without_default)]

use std::mem;

use crate::build::CheckoutBuilder;
Expand Down Expand Up @@ -78,3 +76,10 @@ impl<'cb> CherrypickOptions<'cb> {
cherrypick_opts
}
}

impl<'cb> Default for CherrypickOptions<'cb> {
/// Creates a default set of cherrypick options
fn default() -> Self {
Self::new()
}
}
8 changes: 3 additions & 5 deletions src/commit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::redundant_closure)]

use std::iter::FusedIterator;
use std::marker;
use std::mem;
Expand Down Expand Up @@ -84,7 +82,7 @@ impl<'repo> Commit<'repo> {
pub fn message_encoding(&self) -> Result<Option<&str>, Error> {
let bytes = unsafe { crate::opt_bytes(self, raw::git_commit_message_encoding(&*self.raw)) };
match bytes {
Some(b) => str::from_utf8(b).map(|s| Some(s)).map_err(|e| e.into()),
Some(b) => str::from_utf8(b).map(Some).map_err(|e| e.into()),
None => Ok(None),
}
}
Expand Down Expand Up @@ -131,7 +129,7 @@ impl<'repo> Commit<'repo> {
/// `Ok(None)` may be returned if there is no summary
pub fn summary(&self) -> Result<Option<&str>, Error> {
match self.summary_bytes() {
Some(sb) => str::from_utf8(sb).map(|s| Some(s)).map_err(|e| e.into()),
Some(sb) => str::from_utf8(sb).map(Some).map_err(|e| e.into()),
None => Ok(None),
}
}
Expand All @@ -155,7 +153,7 @@ impl<'repo> Commit<'repo> {
/// `Ok(None)` may be returned if there is no body.
pub fn body(&self) -> Result<Option<&str>, Error> {
match self.body_bytes() {
Some(sb) => str::from_utf8(sb).map(|s| Some(s)).map_err(|e| e.into()),
Some(sb) => str::from_utf8(sb).map(Some).map_err(|e| e.into()),
None => Ok(None),
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::should_implement_trait)]

use std::ffi::CString;
use std::marker;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -601,6 +599,7 @@ impl<'cfg> ConfigEntries<'cfg> {
/// Advances the iterator and returns the next value.
///
/// Returns `None` when iteration is finished.
#[expect(clippy::should_implement_trait)]
pub fn next(&mut self) -> Option<Result<&ConfigEntry<'cfg>, Error>> {
let mut raw = ptr::null_mut();
drop(self.current.take());
Expand Down
26 changes: 13 additions & 13 deletions src/cred.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#![allow(clippy::manual_strip)]
#![allow(clippy::match_result_ok)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::needless_borrowed_reference)]
#![allow(clippy::needless_borrows_for_generic_args)]
#![allow(clippy::should_implement_trait)]

#[cfg(feature = "cred")]
use log::{debug, trace};
use std::ffi::CString;
Expand Down Expand Up @@ -39,6 +32,7 @@ pub struct CredentialHelper {
impl Cred {
/// Create a "default" credential usable for Negotiate mechanisms like NTLM
/// or Kerberos authentication.
#[expect(clippy::should_implement_trait)]
pub fn default() -> Result<Cred, Error> {
crate::init();
let mut out = ptr::null_mut();
Expand Down Expand Up @@ -171,6 +165,11 @@ impl Cred {
}

/// Unwrap access to the underlying raw pointer, canceling the destructor
///
/// # Safety
///
/// The caller must assume responsibility for freeing the credential if
/// needed. See the drop implementation for guidance.
pub unsafe fn unwrap(mut self) -> *mut raw::git_cred {
mem::replace(&mut self.raw, ptr::null_mut())
}
Expand Down Expand Up @@ -277,14 +276,14 @@ impl CredentialHelper {
// Discover `useHttpPath` from `config`
fn config_use_http_path(&mut self, config: &Config) {
let mut use_http_path = false;
if let Some(value) = config.get_bool(&self.exact_key("useHttpPath")).ok() {
if let Ok(value) = config.get_bool(&self.exact_key("useHttpPath")) {
use_http_path = value;
} else if let Some(value) = self
.url_key("useHttpPath")
.and_then(|key| config.get_bool(&key).ok())
{
use_http_path = value;
} else if let Some(value) = config.get_bool("credential.useHttpPath").ok() {
} else if let Ok(value) = config.get_bool("credential.useHttpPath") {
use_http_path = value;
}

Expand Down Expand Up @@ -313,8 +312,8 @@ impl CredentialHelper {
Some(s) => s,
};

if cmd.starts_with('!') {
self.commands.push(cmd[1..].to_string());
if let Some(stripped) = cmd.strip_prefix('!') {
self.commands.push(stripped.to_string());
} else if is_absolute_path(cmd) {
self.commands.push(cmd.to_string());
} else {
Expand All @@ -328,7 +327,7 @@ impl CredentialHelper {

fn url_key(&self, name: &str) -> Option<String> {
match (&self.host, &self.protocol) {
(&Some(ref host), &Some(ref protocol)) => {
(Some(host), Some(protocol)) => {
Some(format!("credential.{}://{}.{}", protocol, host, name))
}
_ => None,
Expand Down Expand Up @@ -398,7 +397,7 @@ impl CredentialHelper {
c.creation_flags(CREATE_NO_WINDOW);
}
c.arg("-c")
.arg(&format!("{} get", cmd))
.arg(format!("{} get", cmd))
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
Expand Down Expand Up @@ -502,6 +501,7 @@ impl CredentialHelper {

#[cfg(test)]
#[cfg(feature = "cred")]
#[allow(clippy::needless_borrows_for_generic_args)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[expect]

#[allow(clippy::unused_io_amount)]
#[allow(clippy::useless_conversion)]
mod test {
Expand Down
25 changes: 18 additions & 7 deletions src/diff.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#![allow(clippy::empty_docs)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::new_without_default)]

use libc::{c_char, c_int, c_void, size_t};
use std::ffi::CString;
use std::iter::FusedIterator;
Expand Down Expand Up @@ -956,6 +952,8 @@ impl DiffOptions {

/// Acquire a pointer to the underlying raw options.
///
/// # Safety
///
/// This function is unsafe as the pointer is only valid so long as this
/// structure is not moved, modified, or used elsewhere.
pub unsafe fn raw(&mut self) -> *const raw::git_diff_options {
Expand Down Expand Up @@ -1000,9 +998,9 @@ impl<'diff> ExactSizeIterator for Deltas<'diff> {}
pub enum DiffLineType {
/// These values will be sent to `git_diff_line_cb` along with the line
Context,
///
/// Line was added
Addition,
///
/// Line was removed
Deletion,
/// Both files have no LF at end
ContextEOFNL,
Expand All @@ -1013,7 +1011,7 @@ pub enum DiffLineType {
/// The following values will only be sent to a `git_diff_line_cb` when
/// the content of a diff is being formatted through `git_diff_print`.
FileHeader,
///
/// Line represents the header of a hunk, e.g. "@@ -1,2 +0,0 @@\n"
HunkHeader,
/// For "Binary files x and y differ"
Binary,
Expand Down Expand Up @@ -1529,6 +1527,11 @@ impl DiffFindOptions {
// TODO: expose git_diff_similarity_metric

/// Acquire a pointer to the underlying raw options.
///
/// # Safety
///
/// The provided pointer must not be used to manipulate the options, and
/// must not outlive the [`DiffFindOptions`] instance.
pub unsafe fn raw(&mut self) -> *const raw::git_diff_find_options {
&self.raw
}
Expand Down Expand Up @@ -1592,6 +1595,14 @@ impl DiffPatchidOptions {
}
}

impl Default for DiffPatchidOptions {
/// Creates a new set of patchid options,
/// initialized to the default values
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
#[allow(clippy::assign_op_pattern)]
#[allow(clippy::needless_borrows_for_generic_args)]
Expand Down
Loading