Skip to content

Commit 76b471d

Browse files
committed
fix new clippy warnings
1 parent 5fffeac commit 76b471d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/test/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use reqwest::{
1818
};
1919
use std::thread::{self, JoinHandle};
2020
use std::{
21+
fmt::Write as _,
2122
fs,
2223
net::{SocketAddr, TcpListener},
2324
panic,
@@ -508,7 +509,7 @@ impl TestDatabase {
508509
crate::db::migrate(None, &mut conn)?;
509510

510511
// Move all sequence start positions 10000 apart to avoid overlapping primary keys
511-
let query: String = conn
512+
let query = conn
512513
.query(
513514
"
514515
SELECT relname
@@ -523,11 +524,15 @@ impl TestDatabase {
523524
.into_iter()
524525
.map(|row| row.get(0))
525526
.enumerate()
526-
.map(|(i, sequence): (_, String)| {
527+
.fold(String::new(), |mut query, (i, sequence): (_, String)| {
527528
let offset = (i + 1) * 10000;
528-
format!(r#"ALTER SEQUENCE "{sequence}" RESTART WITH {offset};"#)
529-
})
530-
.collect();
529+
write!(
530+
query,
531+
r#"ALTER SEQUENCE "{sequence}" RESTART WITH {offset};"#
532+
)
533+
.expect("could not write to string");
534+
query
535+
});
531536
conn.batch_execute(&query)?;
532537

533538
Ok(TestDatabase { pool, schema })

src/web/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,15 +550,15 @@ impl MetaData {
550550
}
551551

552552
fn parse_doc_targets(targets: Value) -> Vec<String> {
553-
let mut targets = targets
553+
let mut targets: Vec<_> = targets
554554
.as_array()
555555
.map(|array| {
556556
array
557557
.iter()
558558
.filter_map(|item| item.as_str().map(|s| s.to_owned()))
559559
.collect()
560560
})
561-
.unwrap_or_else(Vec::new);
561+
.unwrap_or_default();
562562
targets.sort_unstable();
563563
targets
564564
}

0 commit comments

Comments
 (0)