Skip to content

Commit

Permalink
Fix 1.73.0 clippy lints (#5494)
Browse files Browse the repository at this point in the history
Doesn't do an upgrade of rustc to 1.73.0 as we want to wait for the
cargo response of the curl CVE before updating. In preparation for an
update, we address the clippy lints that are newly firing in 1.73.0.
  • Loading branch information
arpad-m authored Oct 6, 2023
1 parent bfba5e3 commit 607b185
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion libs/utils/src/seqwait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ where
// to get that.
impl<T: Ord> PartialOrd for Waiter<T> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
other.wake_num.partial_cmp(&self.wake_num)
Some(self.cmp(other))
}
}

Expand Down
7 changes: 2 additions & 5 deletions pageserver/src/deletion_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ where
V: Serialize,
I: AsRef<[u8]>,
{
let transformed = input.iter().map(|(k, v)| (hex::encode(k), v.clone()));
let transformed = input.iter().map(|(k, v)| (hex::encode(k), v));

transformed
.collect::<HashMap<String, &V>>()
Expand Down Expand Up @@ -325,10 +325,7 @@ impl DeletionList {
return false;
}

let timeline_entry = tenant_entry
.timelines
.entry(*timeline)
.or_insert_with(Vec::new);
let timeline_entry = tenant_entry.timelines.entry(*timeline).or_default();

let timeline_remote_path = remote_timeline_path(tenant, timeline);

Expand Down
5 changes: 2 additions & 3 deletions pageserver/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,9 @@ impl StorageIoTime {
.expect("failed to define a metric");
let metrics = std::array::from_fn(|i| {
let op = StorageIoOperation::from_repr(i).unwrap();
let metric = storage_io_histogram_vec
storage_io_histogram_vec
.get_metric_with_label_values(&[op.as_str()])
.unwrap();
metric
.unwrap()
});
Self { metrics }
}
Expand Down
3 changes: 1 addition & 2 deletions pageserver/src/tenant/storage_layer/delta_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ impl DeltaLayer {
///
/// This variant is only used for debugging purposes, by the 'pagectl' binary.
pub fn new_for_path(path: &Utf8Path, file: File) -> Result<Self> {
let mut summary_buf = Vec::new();
summary_buf.resize(PAGE_SZ, 0);
let mut summary_buf = vec![0; PAGE_SZ];
file.read_exact_at(&mut summary_buf, 0)?;
let summary = Summary::des_prefix(&summary_buf)?;

Expand Down
3 changes: 1 addition & 2 deletions pageserver/src/tenant/storage_layer/image_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ impl ImageLayer {
///
/// This variant is only used for debugging purposes, by the 'pagectl' binary.
pub fn new_for_path(path: &Utf8Path, file: File) -> Result<ImageLayer> {
let mut summary_buf = Vec::new();
summary_buf.resize(PAGE_SZ, 0);
let mut summary_buf = vec![0; PAGE_SZ];
file.read_exact_at(&mut summary_buf, 0)?;
let summary = Summary::des_prefix(&summary_buf)?;
let metadata = file
Expand Down
4 changes: 2 additions & 2 deletions pageserver/src/tenant/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub struct Timeline {

/// The generation of the tenant that instantiated us: this is used for safety when writing remote objects.
/// Never changes for the lifetime of this [`Timeline`] object.
///
///
/// This duplicates the generation stored in LocationConf, but that structure is mutable:
/// this copy enforces the invariant that generatio doesn't change during a Tenant's lifetime.
generation: Generation,
Expand Down Expand Up @@ -2363,7 +2363,7 @@ impl Timeline {
// during branch creation.
match ancestor.wait_to_become_active(ctx).await {
Ok(()) => {}
Err(state) if state == TimelineState::Stopping => {
Err(TimelineState::Stopping) => {
return Err(PageReconstructError::AncestorStopping(ancestor.timeline_id));
}
Err(state) => {
Expand Down
4 changes: 2 additions & 2 deletions pageserver/src/walredo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ impl PostgresRedoManager {
while nwrite < writebuf.len() {
let n = loop {
match nix::poll::poll(&mut pollfds[0..2], wal_redo_timeout.as_millis() as i32) {
Err(e) if e == nix::errno::Errno::EINTR => continue,
Err(nix::errno::Errno::EINTR) => continue,
res => break res,
}
}?;
Expand Down Expand Up @@ -917,7 +917,7 @@ impl PostgresRedoManager {
// and forward any logging information that the child writes to its stderr to the page server's log.
let n = loop {
match nix::poll::poll(&mut pollfds[1..3], wal_redo_timeout.as_millis() as i32) {
Err(e) if e == nix::errno::Errno::EINTR => continue,
Err(nix::errno::Errno::EINTR) => continue,
res => break res,
}
}?;
Expand Down
4 changes: 2 additions & 2 deletions safekeeper/src/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ impl Timeline {
if horizon_segno <= 1 || horizon_segno <= shared_state.last_removed_segno {
return Ok(()); // nothing to do
}
let remover = shared_state.sk.wal_store.remove_up_to(horizon_segno - 1);

// release the lock before removing
remover
shared_state.sk.wal_store.remove_up_to(horizon_segno - 1)
};

// delete old WAL files
Expand Down

1 comment on commit 607b185

@github-actions
Copy link

@github-actions github-actions bot commented on 607b185 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2318 tests run: 2196 passed, 0 failed, 122 skipped (full report)


Flaky tests (2)

Postgres 14

  • test_heavy_write_workload[neon_off-10-5-5]: release
  • test_heavy_write_workload[neon_on-10-5-5]: release

Code coverage (full report)

  • functions: 52.3% (8117 of 15523 functions)
  • lines: 81.0% (47463 of 58570 lines)

The comment gets automatically updated with the latest test results
607b185 at 2023-10-06T16:48:07.529Z :recycle:

Please sign in to comment.