run cranky locally in nightly + clippy fixes (#1441)

* cleanup one `partial_pub_fields` lint
* run cranky locally in nightly too to align CI lints
This commit is contained in:
extrawurst 2023-10-23 12:45:25 +02:00 committed by GitHub
parent e54f29b0f2
commit 1925a06ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 13 deletions

View File

@ -52,12 +52,12 @@ deny = [
"clippy::unneeded_field_pattern", "clippy::unneeded_field_pattern",
"clippy::unseparated_literal_suffix", "clippy::unseparated_literal_suffix",
"clippy::if_then_some_else_none", "clippy::if_then_some_else_none",
"clippy::use_debug" "clippy::use_debug",
#TODO: #TODO:
#clippy::partial_pub_fields # "clippy::partial_pub_fields"
#clippy::print_stdout # "clippy::print_stdout"
#clippy::unwrap_used # "clippy::unwrap_used"
#clippy::unwrap_in_result # "clippy::unwrap_in_result"
] ]
allow = [ allow = [

View File

@ -26,7 +26,7 @@ use crate::{
}; };
pub struct Repository { pub struct Repository {
pub git_repository: git::Repository, git_repository: git::Repository,
project: projects::Project, project: projects::Project,
lock_file: std::fs::File, lock_file: std::fs::File,
} }
@ -610,6 +610,10 @@ impl Repository {
Ok(()) Ok(())
} }
pub fn git_repository(&self) -> &git::Repository {
&self.git_repository
}
} }
fn build_wd_tree( fn build_wd_tree(

View File

@ -42,11 +42,11 @@ impl<'reader> SessionReader<'reader> {
wd_reader.read(&repository.session_path().join("meta").join("id")) wd_reader.read(&repository.session_path().join("meta").join("id"))
{ {
if current_session_id == session.id.to_string() { if current_session_id == session.id.to_string() {
let head_commit = repository.git_repository.head()?.peel_to_commit()?; let head_commit = repository.git_repository().head()?.peel_to_commit()?;
return Ok(SessionReader { return Ok(SessionReader {
reader: Box::new(wd_reader), reader: Box::new(wd_reader),
previous_reader: CommitReader::from_commit( previous_reader: CommitReader::from_commit(
&repository.git_repository, repository.git_repository(),
&head_commit, &head_commit,
)?, )?,
}); });
@ -67,15 +67,16 @@ impl<'reader> SessionReader<'reader> {
.context(format!("failed to parse commit hash {}", session_hash))?; .context(format!("failed to parse commit hash {}", session_hash))?;
let commit = repository let commit = repository
.git_repository .git_repository()
.find_commit(oid) .find_commit(oid)
.context("failed to get commit")?; .context("failed to get commit")?;
let commit_reader = reader::CommitReader::from_commit(&repository.git_repository, &commit)?; let commit_reader =
reader::CommitReader::from_commit(repository.git_repository(), &commit)?;
Ok(SessionReader { Ok(SessionReader {
reader: Box::new(commit_reader), reader: Box::new(commit_reader),
previous_reader: reader::CommitReader::from_commit( previous_reader: reader::CommitReader::from_commit(
&repository.git_repository, repository.git_repository(),
&commit.parent(0)?, &commit.parent(0)?,
)?, )?,
}) })

View File

@ -968,7 +968,7 @@ pub fn create_virtual_branch(
.read_default() .read_default()
.context("failed to read default")?; .context("failed to read default")?;
let repo = &gb_repository.git_repository; let repo = gb_repository.git_repository();
let commit = repo let commit = repo
.find_commit(default_target.sha) .find_commit(default_target.sha)
.context("failed to find commit")?; .context("failed to find commit")?;

View File

@ -7,7 +7,8 @@ set -o pipefail
function rust() { function rust() {
cargo fmt --check cargo fmt --check
cargo sort -c -w cargo sort -c -w
cargo cranky --all-targets --all-features # use nightly as long cranky is run in nightly on ci
cargo +nightly cranky --all-targets --all-features
cargo test cargo test
} }