Skip to content

Commit

Permalink
fix lints for nightly, and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Mar 10, 2024
1 parent 61c002b commit f8ce3d0
Show file tree
Hide file tree
Showing 342 changed files with 606 additions and 290 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup dependencies
run:
sudo apt-get install tree
- uses: extractions/setup-just@v1
- name: test
env:
CI: true
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
run: just ci-test
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup dependencies
run:
sudo apt-get install tree
- uses: extractions/setup-just@v1
- name: test
env:
CI: true
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
run: just ci-test

test-fast:
strategy:
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
components: clippy,rustfmt
- uses: extractions/setup-just@v1
- name: Run cargo clippy
run: just clippy -D warnings
run: just clippy -D warnings -A unknown-lints
- name: Run cargo doc
run: just doc
- name: Run cargo fmt
Expand All @@ -189,10 +189,10 @@ jobs:
continue-on-error: ${{ matrix.checks == 'advisories' }}

steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
wasm:
name: WebAssembly
runs-on: ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions gitoxide-core/src/repository/credential.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

#[derive(Debug, thiserror::Error)]
enum Error {
#[error(transparent)]
Expand Down
1 change: 1 addition & 0 deletions gix-actor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use gix_date::Time;

mod identity;
///
#[allow(clippy::empty_docs)]
pub mod signature;

/// A person with name and email.
Expand Down
1 change: 1 addition & 0 deletions gix-actor/src/signature/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,6 @@ pub(crate) mod write {
}

///
#[allow(clippy::empty_docs)]
pub mod decode;
pub use decode::function::decode;
4 changes: 4 additions & 0 deletions gix-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ use kstring::{KString, KStringRef};

mod assignment;
///
#[allow(clippy::empty_docs)]
pub mod name;
///
#[allow(clippy::empty_docs)]
pub mod state;

///
#[allow(clippy::empty_docs)]
pub mod search;

///
#[allow(clippy::empty_docs)]
pub mod parse;

/// Parse attribute assignments line by line from `bytes`, and fail the operation on error.
Expand Down
10 changes: 7 additions & 3 deletions gix-attributes/src/search/outcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Outcome {
for (order, macro_attributes) in collection.iter().filter_map(|(_, meta)| {
(!meta.macro_attributes.is_empty()).then_some((meta.id.0, &meta.macro_attributes))
}) {
self.matches_by_id[order].macro_attributes = macro_attributes.clone()
self.matches_by_id[order].macro_attributes.clone_from(macro_attributes)
}

for (name, id) in self.selected.iter_mut().filter(|(_, id)| id.is_none()) {
Expand Down Expand Up @@ -88,7 +88,7 @@ impl Outcome {
/// Note that it's safe to call it multiple times, so that it can be called after this instance was used to store a search result.
pub fn copy_into(&self, collection: &MetadataCollection, dest: &mut Self) {
dest.initialize(collection);
dest.matches_by_id = self.matches_by_id.clone();
dest.matches_by_id.clone_from(&self.matches_by_id);
if dest.patterns.len() != self.patterns.len() {
dest.patterns = self.patterns.clone();
}
Expand Down Expand Up @@ -325,7 +325,11 @@ impl MetadataCollection {
};

self.assign_order_to_attributes(attrs);
self.name_to_meta.get_mut(name).expect("just added").macro_attributes = attrs.clone();
self.name_to_meta
.get_mut(name)
.expect("just added")
.macro_attributes
.clone_from(attrs);

order
}
Expand Down
5 changes: 1 addition & 4 deletions gix-bitmap/src/ewah.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::convert::TryInto;

///
#[allow(clippy::empty_docs)]
pub mod decode {
/// The error returned by [`decode()`][super::decode()].
#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -52,8 +51,6 @@ pub fn decode(data: &[u8]) -> Result<(Vec, &[u8]), decode::Error> {
}

mod access {
use std::convert::{TryFrom, TryInto};

use super::Vec;

impl Vec {
Expand Down
2 changes: 0 additions & 2 deletions gix-bitmap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
pub mod ewah;

pub(crate) mod decode {
use std::convert::TryInto;

#[inline]
pub(crate) fn split_at_pos(data: &[u8], pos: usize) -> Option<(&[u8], &[u8])> {
if data.len() < pos {
Expand Down
2 changes: 1 addition & 1 deletion gix-chunk/src/file/decode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert::TryInto, ops::Range};
use std::ops::Range;

mod error {
/// The value returned by [`crate::file::Index::from_bytes()`]
Expand Down
2 changes: 2 additions & 0 deletions gix-chunk/src/file/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops::Range;
use crate::file::Index;

///
#[allow(clippy::empty_docs)]
pub mod offset_by_kind {
use std::fmt::{Display, Formatter};

Expand All @@ -27,6 +28,7 @@ pub mod offset_by_kind {
}

///
#[allow(clippy::empty_docs)]
pub mod data_by_kind {
/// The error returned by [`Index::data_by_id()`][super::Index::data_by_id()].
#[derive(Debug, thiserror::Error)]
Expand Down
3 changes: 3 additions & 0 deletions gix-chunk/src/file/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
///
#[allow(clippy::empty_docs)]
pub mod decode;
///
#[allow(clippy::empty_docs)]
pub mod index;

///
#[allow(clippy::empty_docs)]
pub mod write;

/// The offset to a chunk as seen relative to the beginning of the file containing it.
Expand Down
4 changes: 3 additions & 1 deletion gix-chunk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ pub type Id = [u8; 4];
pub const SENTINEL: Id = [0u8; 4];

///
#[allow(clippy::empty_docs)]
pub mod range {
use std::{convert::TryInto, ops::Range};
use std::ops::Range;

use crate::file;

Expand All @@ -33,4 +34,5 @@ pub mod range {
}

///
#[allow(clippy::empty_docs)]
pub mod file;
1 change: 1 addition & 0 deletions gix-command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ pub fn extract_interpreter(executable: &Path) -> Option<shebang::Data> {
}

///
#[allow(clippy::empty_docs)]
pub mod shebang {
use bstr::{BStr, ByteSlice};
use std::ffi::OsString;
Expand Down
1 change: 0 additions & 1 deletion gix-commitgraph/src/file/access.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::TryInto,
fmt::{Debug, Formatter},
path::Path,
};
Expand Down
1 change: 0 additions & 1 deletion gix-commitgraph/src/file/commit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Low-level operations on individual commits.
use std::{
convert::TryInto,
fmt::{Debug, Formatter},
slice::Chunks,
};
Expand Down
5 changes: 1 addition & 4 deletions gix-commitgraph/src/file/init.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::path::Path;
use std::path::PathBuf;
use std::{
convert::{TryFrom, TryInto},
path::Path,
};

use bstr::ByteSlice;
use memmap2::Mmap;
Expand Down
1 change: 0 additions & 1 deletion gix-commitgraph/src/init.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::TryFrom,
io::{BufRead, BufReader},
path::{Path, PathBuf},
};
Expand Down
1 change: 1 addition & 0 deletions gix-commitgraph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub fn at(path: impl AsRef<Path>) -> Result<Graph, init::Error> {
mod access;
pub mod file;
///
#[allow(clippy::empty_docs)]
pub mod init;
pub mod verify;

Expand Down
1 change: 0 additions & 1 deletion gix-commitgraph/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use std::{
cmp::{max, min},
collections::BTreeMap,
convert::TryInto,
path::PathBuf,
};

Expand Down
1 change: 0 additions & 1 deletion gix-commitgraph/tests/commitgraph.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
collections::{HashMap, HashSet},
convert::{TryFrom, TryInto},
hash::BuildHasher,
io::{BufRead, Cursor},
path::Path,
Expand Down
2 changes: 1 addition & 1 deletion gix-config-value/src/boolean.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, convert::TryFrom, ffi::OsString, fmt::Display};
use std::{borrow::Cow, ffi::OsString, fmt::Display};

use bstr::{BStr, BString, ByteSlice};

Expand Down
2 changes: 1 addition & 1 deletion gix-config-value/src/color.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(missing_docs)]
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};
use std::{borrow::Cow, fmt::Display, str::FromStr};

use bstr::{BStr, BString};

Expand Down
2 changes: 1 addition & 1 deletion gix-config-value/src/integer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};
use std::{borrow::Cow, fmt::Display, str::FromStr};

use bstr::{BStr, BString};

Expand Down
3 changes: 3 additions & 0 deletions gix-config-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ impl Error {

mod boolean;
///
#[allow(clippy::empty_docs)]
pub mod color;
///
#[allow(clippy::empty_docs)]
pub mod integer;
///
#[allow(clippy::empty_docs)]
pub mod path;

mod types;
Expand Down
1 change: 1 addition & 0 deletions gix-config-value/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use bstr::BStr;
use crate::Path;

///
#[allow(clippy::empty_docs)]
pub mod interpolate {
use std::path::PathBuf;

Expand Down
2 changes: 0 additions & 2 deletions gix-config-value/tests/value/boolean.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use gix_config_value::Boolean;

use crate::b;
Expand Down
2 changes: 0 additions & 2 deletions gix-config-value/tests/value/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ mod attribute {
}

mod from_git {
use std::convert::TryFrom;

use bstr::BStr;
use gix_config_value::Color;

Expand Down
2 changes: 0 additions & 2 deletions gix-config-value/tests/value/integer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use gix_config_value::{integer::Suffix, Integer};

use crate::b;
Expand Down
2 changes: 0 additions & 2 deletions gix-config/benches/large_config_file.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use gix_config::{parse::Events, File};

Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/file/access/comfort.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, convert::TryFrom};
use std::borrow::Cow;

use bstr::BStr;

Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/file/access/raw.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, collections::HashMap, convert::TryInto};
use std::{borrow::Cow, collections::HashMap};

use bstr::BStr;
use smallvec::ToSmallVec;
Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/file/access/read_only.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, convert::TryFrom};
use std::borrow::Cow;

use bstr::{BStr, ByteSlice};
use gix_features::threading::OwnShared;
Expand Down
2 changes: 1 addition & 1 deletion gix-config/src/file/impls.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};
use std::{borrow::Cow, fmt::Display, str::FromStr};

use bstr::{BStr, BString, ByteVec};

Expand Down
1 change: 1 addition & 0 deletions gix-config/src/file/includes/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl Default for Options<'_> {
}

///
#[allow(clippy::empty_docs)]
pub mod conditional {
/// Options to handle conditional includes like `includeIf.<condition>.path`.
#[derive(Clone, Copy, Default)]
Expand Down
1 change: 1 addition & 0 deletions gix-config/src/file/init/comfort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ impl File<'static> {
}

///
#[allow(clippy::empty_docs)]
pub mod from_git_dir {
use crate::file::init;

Expand Down
2 changes: 0 additions & 2 deletions gix-config/src/file/init/from_env.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use bstr::{BStr, ByteSlice};

use crate::{file, file::init, parse, parse::section, path::interpolate, File};
Expand Down
2 changes: 2 additions & 0 deletions gix-config/src/file/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ pub use types::{Error, Options};

mod comfort;
///
#[allow(clippy::empty_docs)]
pub mod from_env;
///
#[allow(clippy::empty_docs)]
pub mod from_paths;

impl<'a> File<'a> {
Expand Down
Loading

0 comments on commit f8ce3d0

Please sign in to comment.