Fix clippy 1.62 (#771)

* clippy let_unit_value

error: this let-binding has unit value
   --> lib/segment/src/vector_storage/simple_vector_storage.rs:397:9
    |
397 | /         let _top_idx = match closest.get(0) {
398 | |             Some(scored_point) => {
399 | |                 assert_ne!(scored_point.idx, 2);
400 | |                 assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);
...   |
404 | |             }
405 | |         };
    | |__________^
    |
    = note: `-D clippy::let-unit-value` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding
    |
397 ~         match closest.get(0) {
398 +             Some(scored_point) => {
399 +                 assert_ne!(scored_point.idx, 2);
400 +                 assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);
401 +             }
402 +             None => {

* clippy format_push_string

error: `format!(..)` appended to existing `String`
   --> src/main.rs:224:21
    |
224 |                     error.push_str(&format!("Deadlock #{}\n", i));
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::format-push-string` implied by `-D warnings`
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: `format!(..)` appended to existing `String`
   --> src/main.rs:226:25
    |
226 | /                         error.push_str(&format!(
227 | |                             "Thread Id {:#?}\n{:#?}\n",
228 | |                             t.thread_id(),
229 | |                             t.backtrace()
230 | |                         ));
    | |__________________________^
    |
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

error: could not compile `qdrant` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `qdrant` due to 2 previous errors
This commit is contained in:
Arnaud Gourlay
2022-07-01 01:59:49 +02:00
committed by GitHub
parent db9e5a3abb
commit cb82b7be01
2 changed files with 8 additions and 5 deletions

View File

@@ -394,7 +394,7 @@ mod tests {
assert_eq!(raw_res1, raw_res2);
let _top_idx = match closest.get(0) {
match closest.get(0) {
Some(scored_point) => {
assert_ne!(scored_point.idx, 2);
assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);

View File

@@ -207,6 +207,7 @@ fn main() -> anyhow::Result<()> {
#[cfg(feature = "service_debug")]
{
use parking_lot::deadlock;
use std::fmt::Write;
const DEADLOCK_CHECK_PERIOD: Duration = Duration::from_secs(10);
@@ -221,13 +222,15 @@ fn main() -> anyhow::Result<()> {
let mut error = format!("{} deadlocks detected\n", deadlocks.len());
for (i, threads) in deadlocks.iter().enumerate() {
error.push_str(&format!("Deadlock #{}\n", i));
writeln!(error, "Deadlock #{}", i).expect("fail to writeln!");
for t in threads {
error.push_str(&format!(
"Thread Id {:#?}\n{:#?}\n",
writeln!(
error,
"Thread Id {:#?}\n{:#?}",
t.thread_id(),
t.backtrace()
));
)
.expect("fail to writeln!");
}
}
log::error!("{}", error);