소스 검색

Disable a few clippy lints and fix others.

Jing Yang 3 년 전
부모
커밋
0bdd359955
5개의 변경된 파일9개의 추가작업 그리고 8개의 파일을 삭제
  1. 1 4
      kvraft/src/async_client.rs
  2. 1 1
      kvraft/src/client.rs
  3. 2 0
      linearizability/src/lib.rs
  4. 3 0
      src/lib.rs
  5. 2 3
      test_utils/src/logging.rs

+ 1 - 4
kvraft/src/async_client.rs

@@ -107,10 +107,7 @@ impl AsyncClient {
                         // Do nothing.
                     }
                     Err(e) => {
-                        panic!(
-                            "Unexpected error with indefinite retry: {:?}",
-                            e
-                        );
+                        panic!("Unexpected error with indefinite retry: {e:?}");
                     }
                 };
             };

+ 1 - 1
kvraft/src/client.rs

@@ -111,7 +111,7 @@ impl ClerkInner {
                     self.unique_id = UniqueIdSequence::new();
                 }
                 Err(e) => {
-                    panic!("Unexpected error with indefinite retry: {:?}", e);
+                    panic!("Unexpected error with indefinite retry: {e:?}")
                 }
             };
         }

+ 2 - 0
linearizability/src/lib.rs

@@ -195,6 +195,7 @@ mod tests {
     }
     #[test]
     fn no_accept() {
+        #[allow(clippy::box_default)]
         let ops = Box::leak(Box::new(vec![]));
         let start = Instant::now();
         for i in 0..4 {
@@ -210,6 +211,7 @@ mod tests {
 
     #[test]
     fn accept() {
+        #[allow(clippy::box_default)]
         let ops = Box::leak(Box::new(vec![]));
         let start = Instant::now();
         for i in 0..4 {

+ 3 - 0
src/lib.rs

@@ -1,3 +1,6 @@
+#![allow(clippy::unchecked_duration_subtraction)]
+#![allow(clippy::uninlined_format_args)]
+
 pub use crate::apply_command::ApplyCommandMessage;
 pub use crate::index_term::IndexTerm;
 pub use crate::log_array::Index;

+ 2 - 3
test_utils/src/logging.rs

@@ -36,8 +36,7 @@ pub fn init_log(module: &str) -> std::io::Result<PathBuf> {
         .take(10)
         .map(char::from)
         .collect();
-    let log_file_name =
-        format!("{}-{:010}-{}.log", module_file, timestamp, suffix);
+    let log_file_name = format!("{module_file}-{timestamp:010}-{suffix}.log");
 
     let log_dir = option_env!("LOG_DIR").unwrap_or(LOG_DIR);
     let mut path = PathBuf::from(log_dir);
@@ -49,7 +48,7 @@ pub fn init_log(module: &str) -> std::io::Result<PathBuf> {
     {
         let mut latest_path = path.clone();
         latest_path.pop();
-        latest_path.push(format!("{}-latest", module_file));
+        latest_path.push(format!("{module_file}-latest"));
         let _ = std::fs::remove_file(latest_path.as_path());
         #[cfg(unix)]
         let _ = std::os::unix::fs::symlink(path.as_path(), latest_path);