From 6d7105bb0d90872dde72bc3f03ca31227ba8f71a Mon Sep 17 00:00:00 2001 From: s1rius Date: Wed, 27 Mar 2024 01:15:07 +0800 Subject: [PATCH] make clippy happy --- examples/hello_world/src/main.rs | 2 ++ ezlog-core/src/config.rs | 1 + ezlogcli/src/main.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/examples/hello_world/src/main.rs b/examples/hello_world/src/main.rs index 698d699..0c27a14 100644 --- a/examples/hello_world/src/main.rs +++ b/examples/hello_world/src/main.rs @@ -121,6 +121,7 @@ fn read_log_file_rewrite() { .read(true) .write(true) .create(true) + .truncate(false) .open(&path) .unwrap(); let mut br = BufReader::new(&file); @@ -135,6 +136,7 @@ fn read_log_file_rewrite() { .read(true) .write(true) .create(true) + .truncate(false) .open(plaintext_log_path) .unwrap(); diff --git a/ezlog-core/src/config.rs b/ezlog-core/src/config.rs index 4782a93..ae6ded7 100644 --- a/ezlog-core/src/config.rs +++ b/ezlog-core/src/config.rs @@ -161,6 +161,7 @@ impl EZLogConfig { .read(true) .write(true) .create(true) + .truncate(false) .open(&path)?; let mut len = file.metadata()?.len(); len = if len != max_size && len != 0 { diff --git a/ezlogcli/src/main.rs b/ezlogcli/src/main.rs index da5c138..470ab73 100644 --- a/ezlogcli/src/main.rs +++ b/ezlogcli/src/main.rs @@ -87,6 +87,7 @@ pub fn main() -> anyhow::Result<()> { let output_file = OpenOptions::new() .write(true) .create(true) + .truncate(false) .open(output) .with_context(|| "output file create error".to_string())?;