Clippy fixes

This commit is contained in:
Eduard Tolosa 2025-04-20 14:50:52 -05:00
parent 573c50d356
commit e421db4013
3 changed files with 4 additions and 4 deletions

View file

@ -23,7 +23,7 @@ pub struct Args {
/// Snapshot id or name to work with.
#[clap(long = "id", default_value = "")]
pub snapshot_id: String,
/// Path to the SQLite database file.
/// Path to the `SQLite` database file.
#[clap(
short = 'd',
long = "dfile",
@ -40,7 +40,7 @@ pub struct Args {
/// Keep only the last X items.
#[clap(short = 'k', long = "keep", default_value = "10")]
pub keep_only: usize,
/// Time in milliseconds until SQLite can return a timeout. Do not touch if you don't know what you are doing.
/// Time in milliseconds until `SQLite` can return a timeout. Do not touch if you don't know what you are doing.
#[clap(long = "timeout", default_value = "5000")]
pub timeout: usize,
/// Create a read-only/ro snapshot.

View file

@ -65,7 +65,7 @@ pub fn return_all_data(connection: &Connection) -> Result<Vec<Database>> {
pub fn return_only_x_items(connection: &Connection, args: &Args) -> Result<Vec<Database>> {
let mut snapshots_data: Vec<Database> = Vec::new();
let mut statement = connection.prepare(&format!("SELECT name,snap_id,kind,source,destination,machine,ro_rw,date FROM (SELECT row_number() over(ORDER BY date DESC) n,* from snapshots WHERE name like '{}%' AND kind = '{}' AND ro_rw = '{}') WHERE n > {}", args.snapshot_prefix, args.snapshot_kind, args.read_write, args.keep_only))?;
let mut statement = connection.prepare(format!("SELECT name,snap_id,kind,source,destination,machine,ro_rw,date FROM (SELECT row_number() over(ORDER BY date DESC) n,* from snapshots WHERE name like '{}%' AND kind = '{}' AND ro_rw = '{}') WHERE n > {}", args.snapshot_prefix, args.snapshot_kind, args.read_write, args.keep_only))?;
while statement.next()? == State::Row {
let db_struct = Database::default();

View file

@ -41,7 +41,7 @@ pub fn del_snapshot(snapshot_name: &str) -> bool {
pub fn restore_snapshot(args: &Args, snapshot_name: &str) -> bool {
!Path::new(&args.dest_dir).exists()
&& Command::new("btrfs")
.args(["subvolume", "snapshot", &snapshot_name, &args.dest_dir])
.args(["subvolume", "snapshot", snapshot_name, &args.dest_dir])
.status()
.expect("Error restoring the snapshot.")
.success()