Skip to content

Commit 2f9f0ac

Browse files
committed
Merge branch 'status'
2 parents 2856434 + acc1331 commit 2f9f0ac

File tree

28 files changed

+140
-111
lines changed

28 files changed

+140
-111
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gitoxide-core/src/repository/attributes/validate_baseline.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ pub(crate) mod function {
305305
}
306306

307307
fn parse_exclude(line: &str) -> Option<(String, Baseline)> {
308-
let (left, value) = line.split_at(line.find(|c| c == '\t')?);
308+
let (left, value) = line.split_at(line.find('\t')?);
309309
let value = &value[1..];
310310

311311
let location = if left == "::" {
312312
None
313313
} else {
314-
let mut tokens = left.split(|b| b == ':');
314+
let mut tokens = left.split(':');
315315
let source = tokens.next()?;
316316
let line_number: usize = tokens.next()?.parse().ok()?;
317317
let pattern = tokens.next()?;
@@ -363,8 +363,8 @@ pub(crate) mod function {
363363
"unspecified" => StateRef::Unspecified,
364364
_ => StateRef::from_bytes(info.as_bytes()),
365365
};
366-
path = path.trim_end_matches(|b| b == ':');
367-
let attr = attr.trim_end_matches(|b| b == ':');
366+
path = path.trim_end_matches(':');
367+
let attr = attr.trim_end_matches(':');
368368
let assignment = gix::attrs::AssignmentRef {
369369
name: gix::attrs::NameRef::try_from(attr.as_bytes().as_bstr()).ok()?,
370370
state,

gitoxide-core/src/repository/index/entries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ pub(crate) mod function {
319319

320320
#[cfg(feature = "serde")]
321321
fn to_json(
322-
mut out: &mut impl std::io::Write,
322+
out: &mut impl std::io::Write,
323323
index: &gix::index::File,
324324
entry: &gix::index::Entry,
325325
attrs: Option<Attrs>,
@@ -338,7 +338,7 @@ pub(crate) mod function {
338338
}
339339

340340
serde_json::to_writer(
341-
&mut out,
341+
&mut *out,
342342
&Entry {
343343
stat: &entry.stat,
344344
hex_id: entry.id.to_hex().to_string(),

gix-config/src/file/section/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a> Section<'a> {
7575
/// Stream ourselves to the given `out`, in order to reproduce this section mostly losslessly
7676
/// as it was parsed.
7777
pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> {
78-
self.header.write_to(&mut out)?;
78+
self.header.write_to(&mut *out)?;
7979

8080
if self.body.0.is_empty() {
8181
return Ok(());

gix-config/src/file/write.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl File<'_> {
1818
pub fn write_to_filter(
1919
&self,
2020
mut out: &mut dyn std::io::Write,
21-
mut filter: &mut dyn FnMut(&Section<'_>) -> bool,
21+
filter: &mut dyn FnMut(&Section<'_>) -> bool,
2222
) -> std::io::Result<()> {
2323
let nl = self.detect_newline_style();
2424

@@ -27,7 +27,8 @@ impl File<'_> {
2727
event.write_to(&mut out)?;
2828
}
2929

30-
if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true) && self.sections.values().any(&mut filter)
30+
if !ends_with_newline(self.frontmatter_events.as_ref(), nl, true)
31+
&& self.sections.values().any(&mut *filter)
3132
{
3233
out.write_all(nl)?;
3334
}

gix-config/src/parse/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl Event<'_> {
3333

3434
/// Stream ourselves to the given `out`, in order to reproduce this event mostly losslessly
3535
/// as it was parsed.
36-
pub fn write_to(&self, mut out: &mut dyn std::io::Write) -> std::io::Result<()> {
36+
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
3737
match self {
3838
Self::ValueNotDone(e) => {
3939
out.write_all(e.as_ref())?;
@@ -42,8 +42,8 @@ impl Event<'_> {
4242
Self::Whitespace(e) | Self::Newline(e) | Self::Value(e) | Self::ValueDone(e) => out.write_all(e.as_ref()),
4343
Self::KeyValueSeparator => out.write_all(b"="),
4444
Self::SectionKey(k) => out.write_all(k.0.as_ref()),
45-
Self::SectionHeader(h) => h.write_to(&mut out),
46-
Self::Comment(c) => c.write_to(&mut out),
45+
Self::SectionHeader(h) => h.write_to(out),
46+
Self::Comment(c) => c.write_to(out),
4747
}
4848
}
4949

gix-config/src/parse/events.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>;
2828
///
2929
/// For concrete examples, some notable differences are:
3030
/// - `git-config` sections permit subsections via either a quoted string
31-
/// (`[some-section "subsection"]`) or via the deprecated dot notation
32-
/// (`[some-section.subsection]`). Successful parsing these section names is not
33-
/// well defined in typical `.ini` parsers. This parser will handle these cases
34-
/// perfectly.
31+
/// (`[some-section "subsection"]`) or via the deprecated dot notation
32+
/// (`[some-section.subsection]`). Successful parsing these section names is not
33+
/// well defined in typical `.ini` parsers. This parser will handle these cases
34+
/// perfectly.
3535
/// - Comment markers are not strictly defined either. This parser will always
36-
/// and only handle a semicolon or octothorpe (also known as a hash or number
37-
/// sign).
36+
/// and only handle a semicolon or octothorpe (also known as a hash or number
37+
/// sign).
3838
/// - Global properties may be allowed in `.ini` parsers, but is strictly
39-
/// disallowed by this parser.
39+
/// disallowed by this parser.
4040
/// - Only `\t`, `\n`, `\b` `\\` are valid escape characters.
4141
/// - Quoted and semi-quoted values will be parsed (but quotes will be included
42-
/// in event outputs). An example of a semi-quoted value is `5"hello world"`,
43-
/// which should be interpreted as `5hello world` after
44-
/// [normalization][crate::value::normalize()].
42+
/// in event outputs). An example of a semi-quoted value is `5"hello world"`,
43+
/// which should be interpreted as `5hello world` after
44+
/// [normalization][crate::value::normalize()].
4545
/// - Line continuations via a `\` character is supported (inside or outside of quotes)
4646
/// - Whitespace handling similarly follows the `git-config` specification as
47-
/// closely as possible, where excess whitespace after a non-quoted value are
48-
/// trimmed, and line continuations onto a new line with excess spaces are kept.
47+
/// closely as possible, where excess whitespace after a non-quoted value are
48+
/// trimmed, and line continuations onto a new line with excess spaces are kept.
4949
/// - Only equal signs (optionally padded by spaces) are valid name/value
50-
/// delimiters.
50+
/// delimiters.
5151
///
5252
/// Note that things such as case-sensitivity or duplicate sections are
5353
/// _not_ handled. This parser is a low level _syntactic_ interpreter
@@ -62,8 +62,8 @@ pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>;
6262
/// # Trait Implementations
6363
///
6464
/// - This struct does _not_ implement [`FromStr`] due to lifetime
65-
/// constraints implied on the required `from_str` method. Instead, it provides
66-
/// [`From<&'_ str>`].
65+
/// constraints implied on the required `from_str` method. Instead, it provides
66+
/// [`From<&'_ str>`].
6767
///
6868
/// # Idioms
6969
///

gix-fs/src/symlink.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
use std::{io, io::ErrorKind::AlreadyExists, path::Path};
22

3-
#[cfg(not(windows))]
43
/// Create a new symlink at `link` which points to `original`.
54
///
65
/// Note that `original` doesn't have to exist.
6+
#[cfg(not(windows))]
77
pub fn create(original: &Path, link: &Path) -> io::Result<()> {
88
std::os::unix::fs::symlink(original, link)
99
}
1010

11-
#[cfg(not(windows))]
1211
/// Remove a symlink.
1312
///
1413
/// Note that on only on windows this is special.
14+
#[cfg(not(windows))]
1515
pub fn remove(path: &Path) -> io::Result<()> {
1616
std::fs::remove_file(path)
1717
}
@@ -31,12 +31,12 @@ pub fn remove(path: &Path) -> io::Result<()> {
3131
}
3232
}
3333

34-
#[cfg(windows)]
3534
/// Create a new symlink at `link` which points to `original`.
3635
///
3736
/// Note that if a symlink target (the `original`) isn't present on disk, it's assumed to be a
3837
/// file, creating a dangling file symlink. This is similar to a dangling symlink on Unix,
3938
/// which doesn't have to care about the target type though.
39+
#[cfg(windows)]
4040
pub fn create(original: &Path, link: &Path) -> io::Result<()> {
4141
use std::os::windows::fs::{symlink_dir, symlink_file};
4242
// TODO: figure out if links to links count as files or whatever they point at
@@ -53,20 +53,20 @@ pub fn create(original: &Path, link: &Path) -> io::Result<()> {
5353
}
5454
}
5555

56-
#[cfg(not(windows))]
5756
/// Return true if `err` indicates that a file collision happened, i.e. a symlink couldn't be created as the `link`
5857
/// already exists as filesystem object.
58+
#[cfg(not(windows))]
5959
pub fn is_collision_error(err: &std::io::Error) -> bool {
6060
// TODO: use ::IsDirectory as well when stabilized instead of raw_os_error(), and ::FileSystemLoop respectively
6161
err.kind() == AlreadyExists
62-
|| err.raw_os_error() == Some(if cfg!(windows) { 5 } else { 21 })
62+
|| err.raw_os_error() == Some(21)
6363
|| err.raw_os_error() == Some(62) // no-follow on symlnk on mac-os
6464
|| err.raw_os_error() == Some(40) // no-follow on symlnk on ubuntu
6565
}
6666

67-
#[cfg(windows)]
6867
/// Return true if `err` indicates that a file collision happened, i.e. a symlink couldn't be created as the `link`
6968
/// already exists as filesystem object.
69+
#[cfg(windows)]
7070
pub fn is_collision_error(err: &std::io::Error) -> bool {
7171
err.kind() == AlreadyExists || err.kind() == std::io::ErrorKind::PermissionDenied
7272
}

gix-ignore/src/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Search {
5555
.transpose()?,
5656
);
5757
group.patterns.extend(pattern::List::<Ignore>::from_file(
58-
&git_dir.join("info").join("exclude"),
58+
git_dir.join("info").join("exclude"),
5959
None,
6060
follow_symlinks,
6161
buf,

gix-odb/tests/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ gix-date = { path = "../../gix-date" }
2424
gix-object = { path = "../../gix-object" }
2525
gix-pack = { path = "../../gix-pack" }
2626

27-
gix-testtools = { path = "../../tests/tools"}
27+
gix-testtools = { path = "../../tests/tools" }
2828
gix-actor = { path = "../../gix-actor" }
2929
pretty_assertions = "1.0.0"
3030
filetime = "0.2.15"
3131
maplit = "1.0.2"
32+
crossbeam-channel = "0.5.13"
3233

0 commit comments

Comments
 (0)