mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 13:20:42 +00:00
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:
parent
ba82317da5
commit
7b9391f36e
4 changed files with 4 additions and 8 deletions
|
|
@ -1,15 +1,12 @@
|
|||
use crate::actions::Manifest;
|
||||
use crate::fmri::Fmri;
|
||||
use crate::repository::catalog::{CatalogManager, CatalogPart, PackageVersionEntry};
|
||||
use lz4::{Decoder as Lz4Decoder, EncoderBuilder as Lz4EncoderBuilder};
|
||||
use miette::Diagnostic;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::io::{Cursor, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use thiserror::Error;
|
||||
use tracing::{info, trace, warn};
|
||||
|
||||
/// Errors that can occur when working with the image catalog
|
||||
#[derive(Error, Debug, Diagnostic)]
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
//!
|
||||
//! 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 sha2::{Digest, Sha256};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
use crate::actions::Manifest;
|
||||
use crate::fmri::Fmri;
|
||||
use crate::repository::catalog::CatalogManager;
|
||||
use base64::Engine as _;
|
||||
use miette::Diagnostic;
|
||||
use rusqlite::Connection;
|
||||
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.
|
||||
/// Creates tables if absent (idempotent).
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub async fn get_shard_blob(
|
|||
|
||||
// Find which shard file corresponds to this hash
|
||||
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 {
|
||||
shard_path = Some(shard_dir.join(&sha256));
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue