Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some clippy warnings. #1464

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl Config {
self.get_path().join("DO_NOT_USE_THIS_DIRECTORY_FOR_ANYTHING"),
);

let file = self.try_lock(options.open(&self.db_path())?)?;
let file = self.try_lock(options.open(self.db_path())?)?;
maybe_fsync_directory(self.get_path())?;
Ok(file)
}
Expand Down Expand Up @@ -619,7 +619,7 @@ impl Config {

fn write_config(&self) -> Result<()> {
let bytes = self.serialize();
let crc: u32 = crc32(&*bytes);
let crc: u32 = crc32(&bytes);
let crc_arr = u32_to_arr(crc);

let temp_path = self.get_path().join("conf.tmp");
Expand All @@ -629,7 +629,7 @@ impl Config {
fs::OpenOptions::new().write(true).create(true).open(&temp_path)?;

io_fail!(self, "write_config bytes");
f.write_all(&*bytes)?;
f.write_all(&bytes)?;
io_fail!(self, "write_config crc");
f.write_all(&crc_arr)?;
io_fail!(self, "write_config fsync");
Expand Down Expand Up @@ -672,7 +672,7 @@ impl Config {
f.read_exact(&mut crc_arr)?;
let crc_expected = arr_to_u32(&crc_arr);

let crc_actual = crc32(&*buf);
let crc_actual = crc32(&buf);

if crc_expected != crc_actual {
warn!(
Expand Down Expand Up @@ -771,7 +771,7 @@ impl Drop for Inner {
if self.temporary {
// Our files are temporary, so nuke them.
debug!("removing temporary storage file {:?}", self.get_path());
let _res = fs::remove_dir_all(&self.get_path());
let _res = fs::remove_dir_all(self.get_path());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ebr/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl Local {
/// Returns a reference to the `Collector` in which this `Local` resides.
#[inline]
pub(super) fn collector(&self) -> &Collector {
unsafe { &**self.collector.get() }
unsafe { &*self.collector.get() }
}

/// Adds `deferred` to the thread-local bag.
Expand Down
2 changes: 1 addition & 1 deletion src/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Debug for Histogram {
for p in &PS {
let res = self.percentile(*p).round();
let line = format!("({} -> {}) ", p, res);
f.write_str(&*line)?;
f.write_str(&line)?;
}

f.write_str("]")
Expand Down
4 changes: 1 addition & 3 deletions src/lru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ impl AccessBlock {
impl Default for AccessQueue {
fn default() -> AccessQueue {
AccessQueue {
writing: AtomicPtr::new(Box::into_raw(Box::new(
AccessBlock::default(),
))),
writing: AtomicPtr::new(Box::into_raw(Box::default())),
full_list: AtomicPtr::default(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ impl Inner {
u8::try_from(prefix_len).unwrap(),
self.is_index,
other_next,
&*items,
&items,
);

ret.rewrite_generations =
Expand Down
2 changes: 1 addition & 1 deletion src/pagecache/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl Heap {
}
}

let iter = self.slabs.iter().zip(bitmaps.into_iter());
let iter = self.slabs.iter().zip(bitmaps);

for (slab, bitmap) in iter {
let tip = slab.tip.load(Acquire);
Expand Down
2 changes: 1 addition & 1 deletion src/pagecache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl Debug for PageCache {
&self,
f: &mut fmt::Formatter<'_>,
) -> std::result::Result<(), fmt::Error> {
f.write_str(&*format!(
f.write_str(&format!(
"PageCache {{ max: {:?} free: {:?} }}\n",
*self.next_pid_to_allocate.lock(),
self.free
Expand Down
2 changes: 1 addition & 1 deletion src/pagecache/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ impl SegmentAccountant {
io_fail!(self.config, "zero garbage segment SA");
pwrite_all(
&self.config.file,
&*vec![MessageKind::Corrupted.into(); self.config.segment_size],
&vec![MessageKind::Corrupted.into(); self.config.segment_size],
segment_base,
)?;
}
Expand Down
4 changes: 2 additions & 2 deletions src/pagecache/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ fn advance_snapshot(
io_fail!(config, "segment initial free zero");
pwrite_all(
&config.file,
&*vec![MessageKind::Corrupted.into(); config.segment_size],
&vec![MessageKind::Corrupted.into(); config.segment_size],
*to_zero,
)?;
if !config.temporary {
Expand Down Expand Up @@ -560,7 +560,7 @@ pub(in crate::pagecache) fn write_snapshot(

// write the snapshot bytes, followed by a crc64 checksum at the end
io_fail!(config, "snap write");
f.write_all(&*bytes)?;
f.write_all(&bytes)?;
io_fail!(config, "snap write len");
f.write_all(&len_bytes)?;
io_fail!(config, "snap write crc");
Expand Down
2 changes: 1 addition & 1 deletion src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ where
if written {
formatter.write_str(", ")?;
}
formatter.write_str(&*format!("({:?}) ", &node))?;
formatter.write_str(&format!("({:?}) ", &node))?;
node.fmt(formatter)?;
written = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sys_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#[cfg(any(target_os = "linux", target_os = "macos"))]
use std::io;
#[cfg(any(target_os = "linux"))]
#[cfg(target_os = "linux")]
use {std::fs::File, std::io::Read};

use std::convert::TryFrom;
Expand Down
2 changes: 1 addition & 1 deletion src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl<E> Transactional<E> for &&Tree {

fn make_overlay(&self) -> Result<TransactionalTrees> {
Ok(TransactionalTrees {
inner: vec![TransactionalTree::from_tree(*self)],
inner: vec![TransactionalTree::from_tree(self)],
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'g> Deref for View<'g> {
type Target = Node;

fn deref(&self) -> &Node {
&*self.node_view
&self.node_view
}
}

Expand Down