summaryrefslogtreecommitdiffstats
path: root/vendor/gix-ref/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/gix-ref/src
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-ref/src')
-rw-r--r--vendor/gix-ref/src/fullname.rs3
-rw-r--r--vendor/gix-ref/src/lib.rs2
-rw-r--r--vendor/gix-ref/src/name.rs4
-rw-r--r--vendor/gix-ref/src/store/file/log/line.rs2
-rw-r--r--vendor/gix-ref/src/store/file/loose/reflog.rs2
-rw-r--r--vendor/gix-ref/src/store/file/overlay_iter.rs4
-rw-r--r--vendor/gix-ref/src/store/file/raw_ext.rs6
-rw-r--r--vendor/gix-ref/src/store/file/transaction/commit.rs6
-rw-r--r--vendor/gix-ref/src/store/file/transaction/prepare.rs29
-rw-r--r--vendor/gix-ref/src/store/general/handle/find.rs2
-rw-r--r--vendor/gix-ref/src/store/general/init.rs2
-rw-r--r--vendor/gix-ref/src/store/packed/transaction.rs2
-rw-r--r--vendor/gix-ref/src/transaction/mod.rs12
13 files changed, 34 insertions, 42 deletions
diff --git a/vendor/gix-ref/src/fullname.rs b/vendor/gix-ref/src/fullname.rs
index 8870e6219..257bbe060 100644
--- a/vendor/gix-ref/src/fullname.rs
+++ b/vendor/gix-ref/src/fullname.rs
@@ -92,8 +92,7 @@ impl FullNameRef {
/// If there is no such prefix, the original name is returned.
pub fn shorten(&self) -> &BStr {
self.category_and_short_name()
- .map(|(_, short)| short)
- .unwrap_or_else(|| self.0.as_bstr())
+ .map_or_else(|| self.0.as_bstr(), |(_, short)| short)
}
/// Classify this name, or return `None` if it's unclassified.
diff --git a/vendor/gix-ref/src/lib.rs b/vendor/gix-ref/src/lib.rs
index cd2e8c27e..2c714d47a 100644
--- a/vendor/gix-ref/src/lib.rs
+++ b/vendor/gix-ref/src/lib.rs
@@ -5,7 +5,7 @@
//! Refs are the way to keep track of objects and come in two flavors.
//!
//! * symbolic refs are pointing to another reference
-//! * peeled refs point to the an object by its [ObjectId][gix_hash::ObjectId]
+//! * peeled refs point to the an object by its [`ObjectId`][gix_hash::ObjectId]
//!
//! They can be identified by a relative path and stored in various flavors.
//!
diff --git a/vendor/gix-ref/src/name.rs b/vendor/gix-ref/src/name.rs
index 5c22069a9..b21fdaf56 100644
--- a/vendor/gix-ref/src/name.rs
+++ b/vendor/gix-ref/src/name.rs
@@ -4,7 +4,7 @@ use gix_object::bstr::{BStr, BString, ByteSlice, ByteVec};
use crate::{Category, FullName, FullNameRef, PartialName, PartialNameRef};
-/// The error used in the [`PartialNameRef`][super::PartialNameRef]::try_from(…) implementations.
+/// The error used in the [`PartialNameRef`][super::PartialNameRef]`::try_from`(…) implementations.
pub type Error = gix_validate::reference::name::Error;
impl<'a> Category<'a> {
@@ -260,7 +260,7 @@ impl convert::TryFrom<BString> for PartialName {
}
}
-/// Note that this method is disagreeing with gix_validate as it allows dashes '-' for some reason.
+/// Note that this method is disagreeing with `gix_validate` as it allows dashes '-' for some reason.
/// Since partial names cannot be created with dashes inside we adjusted this as it's probably unintended or git creates pseudo-refs
/// which wouldn't pass its safety checks.
pub(crate) fn is_pseudo_ref<'a>(name: impl Into<&'a BStr>) -> bool {
diff --git a/vendor/gix-ref/src/store/file/log/line.rs b/vendor/gix-ref/src/store/file/log/line.rs
index 1ac45c75c..99c118ea7 100644
--- a/vendor/gix-ref/src/store/file/log/line.rs
+++ b/vendor/gix-ref/src/store/file/log/line.rs
@@ -88,7 +88,7 @@ pub mod decode {
mod error {
use gix_object::bstr::{BString, ByteSlice};
- /// The error returned by [from_bytes(…)][super::Line::from_bytes()]
+ /// The error returned by [`from_bytes(…)`][super::Line::from_bytes()]
#[derive(Debug)]
pub struct Error {
pub input: BString,
diff --git a/vendor/gix-ref/src/store/file/loose/reflog.rs b/vendor/gix-ref/src/store/file/loose/reflog.rs
index a43d773fe..88a8c2450 100644
--- a/vendor/gix-ref/src/store/file/loose/reflog.rs
+++ b/vendor/gix-ref/src/store/file/loose/reflog.rs
@@ -231,7 +231,7 @@ pub mod create_or_update {
}
mod error {
- /// The error returned by [crate::file::Store::reflog_iter()].
+ /// The error returned by [`crate::file::Store::reflog_iter()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
diff --git a/vendor/gix-ref/src/store/file/overlay_iter.rs b/vendor/gix-ref/src/store/file/overlay_iter.rs
index 4c1109beb..795eda654 100644
--- a/vendor/gix-ref/src/store/file/overlay_iter.rs
+++ b/vendor/gix-ref/src/store/file/overlay_iter.rs
@@ -197,7 +197,7 @@ impl<'s> Platform<'s> {
/// As [`iter(…)`][file::Store::iter()], but filters by `prefix`, i.e. "refs/heads".
///
- /// Please note that "refs/heads` or "refs\\heads" is equivalent to "refs/heads/"
+ /// Please note that "refs/heads" or "refs\\heads" is equivalent to "refs/heads/"
pub fn prefixed(&self, prefix: impl AsRef<Path>) -> std::io::Result<LooseThenPacked<'_, '_>> {
self.store
.iter_prefixed_packed(prefix, self.packed.as_ref().map(|b| &***b))
@@ -349,7 +349,7 @@ impl file::Store {
/// As [`iter(…)`][file::Store::iter()], but filters by `prefix`, i.e. "refs/heads".
///
- /// Please note that "refs/heads` or "refs\\heads" is equivalent to "refs/heads/"
+ /// Please note that "refs/heads" or "refs\\heads" is equivalent to "refs/heads/"
pub fn iter_prefixed_packed<'s, 'p>(
&'s self,
prefix: impl AsRef<Path>,
diff --git a/vendor/gix-ref/src/store/file/raw_ext.rs b/vendor/gix-ref/src/store/file/raw_ext.rs
index 8bdf8392d..b99bbbdd9 100644
--- a/vendor/gix-ref/src/store/file/raw_ext.rs
+++ b/vendor/gix-ref/src/store/file/raw_ext.rs
@@ -17,17 +17,17 @@ pub trait ReferenceExt: Sealed {
/// A step towards obtaining forward or reverse iterators on reference logs.
fn log_iter<'a, 's>(&'a self, store: &'s file::Store) -> log::iter::Platform<'a, 's>;
- /// For details, see [Reference::log_exists()].
+ /// For details, see [`Reference::log_exists()`].
fn log_exists(&self, store: &file::Store) -> bool;
- /// For details, see [Reference::peel_to_id_in_place()].
+ /// For details, see [`Reference::peel_to_id_in_place()`].
fn peel_to_id_in_place<E: std::error::Error + Send + Sync + 'static>(
&mut self,
store: &file::Store,
find: impl FnMut(gix_hash::ObjectId, &mut Vec<u8>) -> Result<Option<(gix_object::Kind, &[u8])>, E>,
) -> Result<ObjectId, peel::to_id::Error>;
- /// For details, see [Reference::peel_to_id_in_place()], with support for a known stable packed buffer.
+ /// For details, see [`Reference::peel_to_id_in_place()`], with support for a known stable packed buffer.
fn peel_to_id_in_place_packed<E: std::error::Error + Send + Sync + 'static>(
&mut self,
store: &file::Store,
diff --git a/vendor/gix-ref/src/store/file/transaction/commit.rs b/vendor/gix-ref/src/store/file/transaction/commit.rs
index 58e6a7c99..df32a1403 100644
--- a/vendor/gix-ref/src/store/file/transaction/commit.rs
+++ b/vendor/gix-ref/src/store/file/transaction/commit.rs
@@ -37,7 +37,7 @@ impl<'s, 'p> Transaction<'s, 'p> {
);
// Perform updates first so live commits remain referenced
- for change in updates.iter_mut() {
+ for change in &mut updates {
assert!(!change.update.deref, "Deref mode is turned into splits and turned off");
match &change.update.change {
// reflog first, then reference
@@ -114,7 +114,7 @@ impl<'s, 'p> Transaction<'s, 'p> {
}
}
- for change in updates.iter_mut() {
+ for change in &mut updates {
let (reflog_root, relative_name) = self.store.reflog_base_and_relative_path(change.update.name.as_ref());
match &change.update.change {
Change::Update { .. } => {}
@@ -147,7 +147,7 @@ impl<'s, 'p> Transaction<'s, 'p> {
self.store.force_refresh_packed_buffer().ok();
}
- for change in updates.iter_mut() {
+ for change in &mut updates {
let take_lock_and_delete = match &change.update.change {
Change::Update {
log: LogChange { mode, .. },
diff --git a/vendor/gix-ref/src/store/file/transaction/prepare.rs b/vendor/gix-ref/src/store/file/transaction/prepare.rs
index fdb29619d..bfc5acabc 100644
--- a/vendor/gix-ref/src/store/file/transaction/prepare.rs
+++ b/vendor/gix-ref/src/store/file/transaction/prepare.rs
@@ -75,17 +75,17 @@ impl<'s, 'p> Transaction<'s, 'p> {
(PreviousValue::MustNotExist, _) => {
panic!("BUG: MustNotExist constraint makes no sense if references are to be deleted")
}
- (PreviousValue::ExistingMustMatch(_), None)
- | (PreviousValue::MustExist, Some(_))
- | (PreviousValue::Any, Some(_))
- | (PreviousValue::Any, None) => {}
- (PreviousValue::MustExist, None) | (PreviousValue::MustExistAndMatch(_), None) => {
+ (PreviousValue::ExistingMustMatch(_) | PreviousValue::Any, None)
+ | (PreviousValue::MustExist | PreviousValue::Any, Some(_)) => {}
+ (PreviousValue::MustExist | PreviousValue::MustExistAndMatch(_), None) => {
return Err(Error::DeleteReferenceMustExist {
full_name: change.name(),
})
}
- (PreviousValue::MustExistAndMatch(previous), Some(existing))
- | (PreviousValue::ExistingMustMatch(previous), Some(existing)) => {
+ (
+ PreviousValue::MustExistAndMatch(previous) | PreviousValue::ExistingMustMatch(previous),
+ Some(existing),
+ ) => {
let actual = existing.target.clone();
if *previous != actual {
let expected = previous.clone();
@@ -124,8 +124,7 @@ impl<'s, 'p> Transaction<'s, 'p> {
match (&expected, &existing_ref) {
(PreviousValue::Any, _)
| (PreviousValue::MustExist, Some(_))
- | (PreviousValue::MustNotExist, None)
- | (PreviousValue::ExistingMustMatch(_), None) => {}
+ | (PreviousValue::MustNotExist | PreviousValue::ExistingMustMatch(_), None) => {}
(PreviousValue::MustExist, None) => {
let expected = Target::Peeled(store.object_hash.null());
let full_name = change.name();
@@ -141,8 +140,10 @@ impl<'s, 'p> Transaction<'s, 'p> {
});
}
}
- (PreviousValue::MustExistAndMatch(previous), Some(existing))
- | (PreviousValue::ExistingMustMatch(previous), Some(existing)) => {
+ (
+ PreviousValue::MustExistAndMatch(previous) | PreviousValue::ExistingMustMatch(previous),
+ Some(existing),
+ ) => {
if *previous != existing.target {
let actual = existing.target.clone();
let expected = previous.to_owned();
@@ -180,11 +181,11 @@ impl<'s, 'p> Transaction<'s, 'p> {
};
if (is_effective && !direct_to_packed_refs) || is_symbolic {
- let mut lock = lock.take().map(Ok).unwrap_or_else(obtain_lock)?;
+ let mut lock = lock.take().map_or_else(obtain_lock, Ok)?;
lock.with_mut(|file| match new {
Target::Peeled(oid) => write!(file, "{oid}"),
- Target::Symbolic(name) => write!(file, "ref: {}", name.0),
+ Target::Symbolic(name) => writeln!(file, "ref: {}", name.0),
})?;
Some(lock.close()?)
} else {
@@ -249,7 +250,7 @@ impl<'s, 'p> Transaction<'s, 'p> {
{
let mut edits_for_packed_transaction = Vec::<RefEdit>::new();
let mut needs_packed_refs_lookups = false;
- for edit in updates.iter() {
+ for edit in &updates {
let log_mode = match edit.update.change {
Change::Update {
log: LogChange { mode, .. },
diff --git a/vendor/gix-ref/src/store/general/handle/find.rs b/vendor/gix-ref/src/store/general/handle/find.rs
index 9792b9b7d..2f11f1755 100644
--- a/vendor/gix-ref/src/store/general/handle/find.rs
+++ b/vendor/gix-ref/src/store/general/handle/find.rs
@@ -5,7 +5,7 @@ use crate::{store, PartialNameRef, Reference};
mod error {
use std::convert::Infallible;
- /// The error returned by [crate::file::Store::find_loose()].
+ /// The error returned by [`crate::file::Store::find_loose()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
diff --git a/vendor/gix-ref/src/store/general/init.rs b/vendor/gix-ref/src/store/general/init.rs
index a9112c0a6..52c582a7a 100644
--- a/vendor/gix-ref/src/store/general/init.rs
+++ b/vendor/gix-ref/src/store/general/init.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use crate::store::WriteReflog;
mod error {
- /// The error returned by [crate::Store::at()].
+ /// The error returned by [`crate::Store::at()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
diff --git a/vendor/gix-ref/src/store/packed/transaction.rs b/vendor/gix-ref/src/store/packed/transaction.rs
index 26cc84b9b..e487e218c 100644
--- a/vendor/gix-ref/src/store/packed/transaction.rs
+++ b/vendor/gix-ref/src/store/packed/transaction.rs
@@ -68,7 +68,7 @@ impl packed::Transaction {
.collect();
let mut buf = Vec::new();
- for edit in edits.iter_mut() {
+ for edit in &mut edits {
if let Change::Update {
new: Target::Peeled(new),
..
diff --git a/vendor/gix-ref/src/transaction/mod.rs b/vendor/gix-ref/src/transaction/mod.rs
index d13ff2e70..77ab7349d 100644
--- a/vendor/gix-ref/src/transaction/mod.rs
+++ b/vendor/gix-ref/src/transaction/mod.rs
@@ -96,19 +96,11 @@ impl Change {
match self {
// TODO: use or-patterns once MRV is larger than 1.52 (and this is supported)
Change::Update {
- expected: PreviousValue::MustExistAndMatch(previous),
- ..
- }
- | Change::Update {
- expected: PreviousValue::ExistingMustMatch(previous),
- ..
- }
- | Change::Delete {
- expected: PreviousValue::MustExistAndMatch(previous),
+ expected: PreviousValue::MustExistAndMatch(previous) | PreviousValue::ExistingMustMatch(previous),
..
}
| Change::Delete {
- expected: PreviousValue::ExistingMustMatch(previous),
+ expected: PreviousValue::MustExistAndMatch(previous) | PreviousValue::ExistingMustMatch(previous),
..
} => previous,
_ => return None,