Skip to content

Commit 5c48bd8

Browse files
committed
Upgrade Rust to 1.89.0
1 parent afebf18 commit 5c48bd8

File tree

16 files changed

+63
-62
lines changed

16 files changed

+63
-62
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14-
- uses: dtolnay/rust-toolchain@1.85.1
14+
- uses: dtolnay/rust-toolchain@1.89.0
1515
id: toolchain
1616
with:
1717
components: clippy, rustfmt

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.85.1
1+
1.89.0

src/encoding/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ impl Formatter for SQL {
192192

193193
fn value(key: &[u8], value: &[u8]) -> String {
194194
// Special-case the applied_index key.
195-
if key == sql::engine::Raft::APPLIED_INDEX_KEY {
196-
if let Ok(applied_index) = bincode::deserialize::<raft::Index>(value) {
197-
return applied_index.to_string();
198-
}
195+
if key == sql::engine::Raft::APPLIED_INDEX_KEY
196+
&& let Ok(applied_index) = bincode::deserialize::<raft::Index>(value)
197+
{
198+
return applied_index.to_string();
199199
}
200200

201201
let Ok(key) = sql::engine::Key::decode(key) else {

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::all)]
2+
#![allow(clippy::large_enum_variant)]
23
#![allow(clippy::module_inception)]
34
#![allow(clippy::type_complexity)]
45

src/raft/log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl Log {
240240
}
241241

242242
/// Returns an iterator over log entries in the given index range.
243-
pub fn scan(&mut self, range: impl RangeBounds<Index>) -> Iterator {
243+
pub fn scan(&mut self, range: impl RangeBounds<Index>) -> Iterator<'_> {
244244
let from = match range.start_bound() {
245245
Bound::Excluded(&index) => Bound::Excluded(Key::Entry(index).encode()),
246246
Bound::Included(&index) => Bound::Included(Key::Entry(index).encode()),
@@ -256,7 +256,7 @@ impl Log {
256256

257257
/// Returns an iterator over entries that are ready to apply, starting after
258258
/// the current applied index up to the commit index.
259-
pub fn scan_apply(&mut self, applied_index: Index) -> Iterator {
259+
pub fn scan_apply(&mut self, applied_index: Index) -> Iterator<'_> {
260260
// NB: we don't assert that commit_index >= applied_index, because the
261261
// local commit index is not flushed to durable storage -- if lost on
262262
// restart, it can be recovered from the logs of a quorum.

src/raft/node.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ impl RawNode<Follower> {
425425
Message::Campaign { last_index, last_term } => {
426426
// Don't vote if we already voted for someone else in this term.
427427
// We can repeat our vote for the same node though.
428-
if let (_, Some(vote)) = self.log.get_term_vote() {
429-
if msg.from != vote {
430-
self.send(msg.from, Message::CampaignResponse { vote: false })?;
431-
return Ok(self.into());
432-
}
428+
if let (_, Some(vote)) = self.log.get_term_vote()
429+
&& msg.from != vote
430+
{
431+
self.send(msg.from, Message::CampaignResponse { vote: false })?;
432+
return Ok(self.into());
433433
}
434434

435435
// Only vote if the candidate's log is at least as long as ours.
@@ -2020,12 +2020,12 @@ mod tests {
20202020
let peer_len = symmetric.get(peer).map(|p| p.len()).unwrap_or(0);
20212021
// If this peer set is the smallest (or we're the higher ID),
20222022
// remove the entry. We may no longer be in the map.
2023-
if len < peer_len || len == peer_len && id > peer {
2024-
if let Some(peers) = symmetric.get_mut(id) {
2025-
peers.remove(peer);
2026-
if peers.is_empty() {
2027-
symmetric.remove(id);
2028-
}
2023+
if (len < peer_len || len == peer_len && id > peer)
2024+
&& let Some(peers) = symmetric.get_mut(id)
2025+
{
2026+
peers.remove(peer);
2027+
if peers.is_empty() {
2028+
symmetric.remove(id);
20292029
}
20302030
}
20312031
}

src/server.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ impl Server {
211211
// forward it to the waiting client via the response channel.
212212
recv(node_rx) -> result => {
213213
let msg = result.expect("node_rx disconnected");
214-
if msg.to == node.id() {
215-
if let raft::Message::ClientResponse{ id, response } = msg.message {
216-
if let Some(response_tx) = response_txs.remove(&id) {
217-
response_tx.send(response).expect("response_tx disconnected");
218-
}
219-
continue
214+
if msg.to == node.id()
215+
&& let raft::Message::ClientResponse{ id, response } = msg.message
216+
{
217+
if let Some(response_tx) = response_txs.remove(&id) {
218+
response_tx.send(response).expect("response_tx disconnected");
220219
}
220+
continue
221221
}
222222
let peer_tx = peers_tx.get_mut(&msg.to).expect("unknown peer");
223223
match peer_tx.try_send(msg) {

src/sql/engine/local.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ impl<E: storage::Engine> super::Transaction for Transaction<E> {
229229

230230
for id in ids {
231231
// Update any secondary index entries.
232-
if !indexes.is_empty() {
233-
if let Some(row) = self.get_row(&table.name, id)? {
234-
for (i, column) in indexes.iter().copied() {
235-
let mut ids = self.get_index(&table.name, &column.name, &row[i])?;
236-
ids.remove(id);
237-
self.set_index(&table.name, &column.name, &row[i], ids)?;
238-
}
232+
if !indexes.is_empty()
233+
&& let Some(row) = self.get_row(&table.name, id)?
234+
{
235+
for (i, column) in indexes.iter().copied() {
236+
let mut ids = self.get_index(&table.name, &column.name, &row[i])?;
237+
ids.remove(id);
238+
self.set_index(&table.name, &column.name, &row[i], ids)?;
239239
}
240240
}
241241

src/sql/execution/executor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ impl<'a, T: Transaction> Executor<'a, T> {
243243
if values.len() > table.columns.len() {
244244
return errinput!("too many values for table {}", table.name);
245245
}
246-
if let Some(column_map) = &column_map {
247-
if column_map.len() != values.len() {
248-
return errinput!("column and value counts do not match");
249-
}
246+
if let Some(column_map) = &column_map
247+
&& column_map.len() != values.len()
248+
{
249+
return errinput!("column and value counts do not match");
250250
}
251251

252252
// Map source columns to table columns, and fill in default values.

src/sql/execution/join.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl NestedLoopJoiner {
7575
return Ok(Some(
7676
left.iter()
7777
.cloned()
78-
.chain(std::iter::repeat(Value::Null).take(self.right_columns))
78+
.chain(std::iter::repeat_n(Value::Null, self.right_columns))
7979
.collect(),
8080
));
8181
}
@@ -172,7 +172,7 @@ impl HashJoiner {
172172
// join, emit a row with right NULLs.
173173
return Ok(Some(
174174
left.into_iter()
175-
.chain(std::iter::repeat(Value::Null).take(self.right_columns))
175+
.chain(std::iter::repeat_n(Value::Null, self.right_columns))
176176
.collect(),
177177
));
178178
}

0 commit comments

Comments
 (0)