Remove module-wide dead_code allows, annotate individual items instead
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@@ -271,6 +269,7 @@ pub fn delete_backup(db: &Database, backup_id: i64) -> Result<(), BackupError> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Remove backups older than the specified number of days.
|
/// Remove backups older than the specified number of days.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn auto_cleanup_old_backups(db: &Database, retention_days: u32) -> Result<u32, BackupError> {
|
pub fn auto_cleanup_old_backups(db: &Database, retention_days: u32) -> Result<u32, BackupError> {
|
||||||
let backups = db.get_all_config_backups().unwrap_or_default();
|
let backups = db.get_all_config_backups().unwrap_or_default();
|
||||||
let cutoff = chrono::Utc::now() - chrono::Duration::days(retention_days as i64);
|
let cutoff = chrono::Utc::now() - chrono::Duration::days(retention_days as i64);
|
||||||
@@ -293,6 +292,7 @@ pub fn auto_cleanup_old_backups(db: &Database, retention_days: u32) -> Result<u3
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct BackupInfo {
|
pub struct BackupInfo {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub appimage_id: i64,
|
pub appimage_id: i64,
|
||||||
pub app_version: Option<String>,
|
pub app_version: Option<String>,
|
||||||
pub archive_path: String,
|
pub archive_path: String,
|
||||||
@@ -304,8 +304,10 @@ pub struct BackupInfo {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct RestoreResult {
|
pub struct RestoreResult {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub manifest: BackupManifest,
|
pub manifest: BackupManifest,
|
||||||
pub paths_restored: u32,
|
pub paths_restored: u32,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub paths_skipped: u32,
|
pub paths_skipped: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use super::database::Database;
|
use super::database::Database;
|
||||||
use super::security;
|
use super::security;
|
||||||
|
|
||||||
@@ -7,6 +5,7 @@ use super::security;
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct CveNotification {
|
pub struct CveNotification {
|
||||||
pub app_name: String,
|
pub app_name: String,
|
||||||
|
#[allow(dead_code)]
|
||||||
pub appimage_id: i64,
|
pub appimage_id: i64,
|
||||||
pub severity: String,
|
pub severity: String,
|
||||||
pub cve_count: usize,
|
pub cve_count: usize,
|
||||||
@@ -139,6 +138,7 @@ fn send_desktop_notification(notif: &CveNotification) -> Result<(), Notification
|
|||||||
|
|
||||||
/// Run a security scan and send notifications for any new findings.
|
/// Run a security scan and send notifications for any new findings.
|
||||||
/// This is the CLI entry point for `driftwood security --notify`.
|
/// This is the CLI entry point for `driftwood security --notify`.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn scan_and_notify(db: &Database, threshold: &str) -> Vec<CveNotification> {
|
pub fn scan_and_notify(db: &Database, threshold: &str) -> Vec<CveNotification> {
|
||||||
// First run a batch scan to get fresh data
|
// First run a batch scan to get fresh data
|
||||||
let _results = security::batch_scan(db);
|
let _results = security::batch_scan(db);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use super::database::{CveSummary, Database};
|
use super::database::{CveSummary, Database};
|
||||||
use crate::config::VERSION;
|
use crate::config::VERSION;
|
||||||
|
|
||||||
@@ -12,6 +10,7 @@ pub enum ReportFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ReportFormat {
|
impl ReportFormat {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn from_str(s: &str) -> Option<Self> {
|
pub fn from_str(s: &str) -> Option<Self> {
|
||||||
match s.to_lowercase().as_str() {
|
match s.to_lowercase().as_str() {
|
||||||
"json" => Some(Self::Json),
|
"json" => Some(Self::Json),
|
||||||
@@ -21,6 +20,7 @@ impl ReportFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn extension(&self) -> &'static str {
|
pub fn extension(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Json => "json",
|
Self::Json => "json",
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@@ -10,7 +8,7 @@ use notify::{Config, Event, EventKind, RecommendedWatcher, RecursiveMode, Watche
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum WatchEvent {
|
pub enum WatchEvent {
|
||||||
/// One or more AppImage files were created, modified, or deleted.
|
/// One or more AppImage files were created, modified, or deleted.
|
||||||
Changed(Vec<PathBuf>),
|
Changed(#[allow(dead_code)] Vec<PathBuf>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start watching the given directories for AppImage file changes.
|
/// Start watching the given directories for AppImage file changes.
|
||||||
|
|||||||
Reference in New Issue
Block a user