Refactor: Remove unused imports and clean up redundant code

- Eliminated unused imports across multiple modules, including `info`, `trace`, `warn`, `base64`, `PathBuf`, and `fs`.
- Replaced mutable variable assignment with immutable in `populate_obsolete_db`.
- Simplified loop variable handling in `pkg6depotd` shard handler.
This commit is contained in:
Till Wegmueller 2026-02-04 22:47:44 +01:00
parent ba82317da5
commit 7b9391f36e
No known key found for this signature in database
4 changed files with 4 additions and 8 deletions

View file

@ -1,15 +1,12 @@
use crate::actions::Manifest; use crate::actions::Manifest;
use crate::fmri::Fmri; use crate::fmri::Fmri;
use crate::repository::catalog::{CatalogManager, CatalogPart, PackageVersionEntry};
use lz4::{Decoder as Lz4Decoder, EncoderBuilder as Lz4EncoderBuilder}; use lz4::{Decoder as Lz4Decoder, EncoderBuilder as Lz4EncoderBuilder};
use miette::Diagnostic; use miette::Diagnostic;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
use std::fs;
use std::io::{Cursor, Read, Write}; use std::io::{Cursor, Read, Write};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use thiserror::Error; use thiserror::Error;
use tracing::{info, trace, warn};
/// Errors that can occur when working with the image catalog /// Errors that can occur when working with the image catalog
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]

View file

@ -7,11 +7,11 @@
//! //!
//! Downloads catalog shards from the repository server and verifies their integrity. //! Downloads catalog shards from the repository server and verifies their integrity.
use crate::repository::sqlite_catalog::{ShardEntry, ShardIndex}; use crate::repository::sqlite_catalog::ShardIndex;
use miette::Diagnostic; use miette::Diagnostic;
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::Path;
use thiserror::Error; use thiserror::Error;
#[derive(Debug, Error, Diagnostic)] #[derive(Debug, Error, Diagnostic)]

View file

@ -12,7 +12,6 @@
use crate::actions::Manifest; use crate::actions::Manifest;
use crate::fmri::Fmri; use crate::fmri::Fmri;
use crate::repository::catalog::CatalogManager; use crate::repository::catalog::CatalogManager;
use base64::Engine as _;
use miette::Diagnostic; use miette::Diagnostic;
use rusqlite::Connection; use rusqlite::Connection;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -478,7 +477,7 @@ pub fn populate_active_db(
/// Helper function for tests: mark a package as obsolete in obsolete.db. /// Helper function for tests: mark a package as obsolete in obsolete.db.
/// Creates tables if absent (idempotent). /// Creates tables if absent (idempotent).
pub fn populate_obsolete_db(db_path: &Path, fmri: &Fmri) -> Result<(), ShardBuildError> { pub fn populate_obsolete_db(db_path: &Path, fmri: &Fmri) -> Result<(), ShardBuildError> {
let mut conn = Connection::open(db_path)?; let conn = Connection::open(db_path)?;
conn.execute_batch(OBSOLETE_SCHEMA)?; conn.execute_batch(OBSOLETE_SCHEMA)?;
conn.execute( conn.execute(

View file

@ -80,7 +80,7 @@ pub async fn get_shard_blob(
// Find which shard file corresponds to this hash // Find which shard file corresponds to this hash
let mut shard_path: Option<std::path::PathBuf> = None; let mut shard_path: Option<std::path::PathBuf> = None;
for (name, entry) in &index.shards { for (_name, entry) in &index.shards {
if entry.sha256 == sha256 { if entry.sha256 == sha256 {
shard_path = Some(shard_dir.join(&sha256)); shard_path = Some(shard_dir.join(&sha256));
break; break;