Skip to content

Commit b188a7d

Browse files
committed
Fixup Copilot commits and thank clippy
1 parent 6cc8464 commit b188a7d

File tree

101 files changed

+223
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+223
-334
lines changed

etc/msrv-badge.svg

Lines changed: 4 additions & 4 deletions
Loading

gix-actor/src/signature/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub(crate) mod write {
110110

111111
impl From<Error> for std::io::Error {
112112
fn from(err: Error) -> Self {
113-
std::io::Error::new(std::io::ErrorKind::Other, err)
113+
std::io::Error::other(err)
114114
}
115115
}
116116

gix-archive/src/write.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ where
160160
opts.tree_prefix.as_ref(),
161161
)?;
162162
}
163-
ar.finish()
164-
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
163+
ar.finish().map_err(std::io::Error::other)?;
165164
}
166165

167166
Ok(())
@@ -179,25 +178,25 @@ fn append_zip_entry<W: std::io::Write + std::io::Seek>(
179178
let file_opts = zip::write::SimpleFileOptions::default()
180179
.compression_method(zip::CompressionMethod::Deflated)
181180
.compression_level(compression_level)
182-
.large_file(entry.bytes_remaining().map_or(true, |len| len > u32::MAX as usize))
181+
.large_file(entry.bytes_remaining().is_none_or(|len| len > u32::MAX as usize))
183182
.last_modified_time(mtime)
184183
.unix_permissions(if entry.mode.is_executable() { 0o755 } else { 0o644 });
185184
let path = add_prefix(entry.relative_path(), tree_prefix).into_owned();
186185
match entry.mode.kind() {
187186
gix_object::tree::EntryKind::Blob | gix_object::tree::EntryKind::BlobExecutable => {
188187
ar.start_file(path.to_string(), file_opts)
189-
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
188+
.map_err(std::io::Error::other)?;
190189
std::io::copy(&mut entry, ar)?;
191190
}
192191
gix_object::tree::EntryKind::Tree | gix_object::tree::EntryKind::Commit => {
193192
ar.add_directory(path.to_string(), file_opts)
194-
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
193+
.map_err(std::io::Error::other)?;
195194
}
196195
gix_object::tree::EntryKind::Link => {
197196
use bstr::ByteSlice;
198197
std::io::copy(&mut entry, buf)?;
199198
ar.add_symlink(path.to_string(), buf.as_bstr().to_string(), file_opts)
200-
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?;
199+
.map_err(std::io::Error::other)?;
201200
}
202201
}
203202
Ok(())

gix-command/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ mod prepare {
115115
/// If neither this method nor [`with_shell()`](Self::with_shell()) is called, commands are
116116
/// always executed verbatim and directly, without the use of a shell.
117117
pub fn command_may_be_shell_script(mut self) -> Self {
118-
self.use_shell = self.command.to_str().map_or(true, |cmd| {
119-
cmd.as_bytes().find_byteset(b"|&;<>()$`\\\"' \t\n*?[#~=%").is_some()
120-
});
118+
self.use_shell = self
119+
.command
120+
.to_str()
121+
.is_none_or(|cmd| cmd.as_bytes().find_byteset(b"|&;<>()$`\\\"' \t\n*?[#~=%").is_some());
121122
self
122123
}
123124

@@ -289,7 +290,7 @@ mod prepare {
289290
let mut cmd = Command::new(shell);
290291
cmd.arg("-c");
291292
if !prep.args.is_empty() {
292-
if prep.command.to_str().map_or(true, |cmd| !cmd.contains("$@")) {
293+
if prep.command.to_str().is_none_or(|cmd| !cmd.contains("$@")) {
293294
if prep.quote_command {
294295
if let Ok(command) = gix_path::os_str_into_bstr(&prep.command) {
295296
prep.command = gix_path::from_bstring(gix_quote::single(command)).into();

gix-command/tests/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ mod context {
226226
mod prepare {
227227
use std::sync::LazyLock;
228228

229-
static SH: Lazy<&'static str> = Lazy::new(|| {
229+
static SH: LazyLock<&'static str> = LazyLock::new(|| {
230230
gix_path::env::shell()
231231
.to_str()
232232
.expect("`prepare` tests must be run where 'sh' path is valid Unicode")

gix-config/src/file/access/mutate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ impl<'event> File<'event> {
376376
nl: &impl AsRef<[u8]>,
377377
) {
378378
if !ends_with_newline(lhs.as_ref(), nl, true)
379-
&& !rhs.first().map_or(true, |e| e.to_bstr_lossy().starts_with(nl.as_ref()))
379+
&& !rhs.first().is_none_or(|e| e.to_bstr_lossy().starts_with(nl.as_ref()))
380380
{
381381
lhs.push(Event::Newline(Cow::Owned(nl.as_ref().into())));
382382
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'event> SectionMut<'_, 'event> {
7171
text: Cow::Owned({
7272
let mut c = Vec::with_capacity(comment.len());
7373
let mut bytes = comment.iter().peekable();
74-
if !bytes.peek().map_or(true, |b| b.is_ascii_whitespace()) {
74+
if !bytes.peek().is_none_or(|b| b.is_ascii_whitespace()) {
7575
c.insert(0, b' ');
7676
}
7777
c.extend(bytes.map(|b| if *b == b'\n' { b' ' } else { *b }));
@@ -194,7 +194,7 @@ impl<'event> SectionMut<'_, 'event> {
194194
assert!(
195195
whitespace
196196
.as_deref()
197-
.map_or(true, |ws| ws.iter().all(u8::is_ascii_whitespace)),
197+
.is_none_or(|ws| ws.iter().all(u8::is_ascii_whitespace)),
198198
"input whitespace must only contain whitespace characters."
199199
);
200200
self.whitespace.pre_key = whitespace;

gix-config/src/parse/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn from_bytes<'a, 'b>(
313313
.into();
314314
}
315315
event => {
316-
if filter.map_or(true, |f| f(&event)) {
316+
if filter.is_none_or(|f| f(&event)) {
317317
events.push(convert(event));
318318
}
319319
}

gix-config/src/parse/nom/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ fn section<'i>(
9696
dispatch: &mut dyn FnMut(Event<'i>),
9797
) -> ModalResult<(), NomError<&'i [u8]>> {
9898
let start = i.checkpoint();
99-
let header = section_header(i).map_err(|e| {
99+
let header = section_header(i).inspect_err(|_err| {
100100
i.reset(&start);
101-
e
102101
})?;
103102
dispatch(Event::SectionHeader(header));
104103

gix-credentials/examples/custom-helper.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ pub fn main() -> Result<(), gix_credentials::program::main::Error> {
1313
password: Some("pass".into()),
1414
..context
1515
})),
16-
program::main::Action::Erase => Err(std::io::Error::new(
17-
std::io::ErrorKind::Other,
16+
program::main::Action::Erase => Err(std::io::Error::other(
1817
"Refusing to delete credentials for demo purposes",
1918
)),
2019
program::main::Action::Store => Ok(None),

0 commit comments

Comments
 (0)