From 5f88c0f5ed2d4c5657db81b89db94a0812a92de8 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Fri, 17 Dec 2021 18:04:23 +0100 Subject: [PATCH 1/2] Clippy --- src/build.rs | 5 ++--- src/command_runner.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/build.rs b/src/build.rs index 180cce0..02566e2 100644 --- a/src/build.rs +++ b/src/build.rs @@ -44,9 +44,8 @@ pub fn create_static_output_files(source_dir: &str) { } } Err(err) => { - if err.kind() == NotFound { - } else { - Err(err).unwrap() + if err.kind() != NotFound { + panic!("Unexpected error: {}", err) } } } diff --git a/src/command_runner.rs b/src/command_runner.rs index b672a4c..5f37ca1 100644 --- a/src/command_runner.rs +++ b/src/command_runner.rs @@ -181,7 +181,7 @@ where { async fn run(&self, program: &str, args: &[&OsStr], input: &str) -> IoResult { let raw_new_args = [self.user_name, "-s", "/usr/bin/env", "--", program]; - let mut new_args: Vec<&OsStr> = raw_new_args.iter().map(|s| s.as_ref()).collect(); + let mut new_args: Vec<&OsStr> = raw_new_args.iter().map(AsRef::as_ref).collect(); new_args.extend_from_slice(args); self.command_runner.run("su", &new_args, input).await } From 92ac0d03848182b3d7470cd268eeea37c307bfce Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Fri, 17 Dec 2021 19:30:02 +0100 Subject: [PATCH 2/2] Fix mariadb dump logic on unchanged database --- src/symbols/mariadb/dump.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/symbols/mariadb/dump.rs b/src/symbols/mariadb/dump.rs index 1b503fa..11accac 100644 --- a/src/symbols/mariadb/dump.rs +++ b/src/symbols/mariadb/dump.rs @@ -36,7 +36,7 @@ impl, C: CommandRunner, S: Storage> Symbol for Dump<'_, N, C, S> { let dump_date = self.storage.recent_date()?; let output = self.run_sql(&format!("select UNIX_TIMESTAMP(MAX(UPDATE_TIME)) from information_schema.tables WHERE table_schema = '{}'", self.db_name.as_ref())).await?; let modified_date = output.trim_end(); - Ok(modified_date != "NULL" && u64::from_str(modified_date)? <= dump_date) + Ok(modified_date == "NULL" || u64::from_str(modified_date)? <= dump_date) } async fn execute(&self) -> Result<(), Box> {