Skip to content

Commit

Permalink
Make current Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold authored and cberner committed May 10, 2024
1 parent cae8038 commit e93051a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fn main() {
println!("cargo:rustc-check-cfg=cfg(fuzzing)");

if std::env::var("CARGO_CFG_FUZZING").is_ok()
&& std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos")
{
Expand Down
1 change: 1 addition & 0 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ impl Builder {
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(path)?;

Database::new(
Expand Down
8 changes: 4 additions & 4 deletions src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ impl<'db> TableNamespace<'db> {
}

#[track_caller]
fn delete_table<'txn>(
fn delete_table(
&mut self,
transaction: &'txn WriteTransaction,
transaction: &WriteTransaction,
name: &str,
) -> Result<bool, TableError> {
#[cfg(feature = "logging")]
Expand All @@ -398,9 +398,9 @@ impl<'db> TableNamespace<'db> {
}

#[track_caller]
fn delete_multimap_table<'txn>(
fn delete_multimap_table(
&mut self,
transaction: &'txn WriteTransaction,
transaction: &WriteTransaction,
name: &str,
) -> Result<bool, TableError> {
#[cfg(feature = "logging")]
Expand Down
2 changes: 1 addition & 1 deletion src/tree_store/page_store/buddy_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl BuddyAllocator {
pub(crate) fn count_free_pages(&self) -> u32 {
let mut pages = 0;
for order in 0..=self.max_order {
pages += self.get_order_free(order).count_unset() * 2u32.pow(order.try_into().unwrap());
pages += self.get_order_free(order).count_unset() * 2u32.pow(order.into());
}
pages
}
Expand Down
8 changes: 4 additions & 4 deletions src/tree_store/page_store/cached_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ impl PrioritizedCache {
priority: CachePriority,
) -> Option<Arc<Vec<u8>>> {
if matches!(priority, CachePriority::Low) {
debug_assert!(self.cache.get(&key).is_none());
debug_assert!(!self.cache.contains_key(&key));
self.low_pri_cache.insert(key, value)
} else {
debug_assert!(self.low_pri_cache.get(&key).is_none());
debug_assert!(!self.low_pri_cache.contains_key(&key));
self.cache.insert(key, value)
}
}
Expand Down Expand Up @@ -140,10 +140,10 @@ impl PrioritizedWriteCache {
fn insert(&mut self, key: u64, value: Arc<Vec<u8>>, priority: CachePriority) {
if matches!(priority, CachePriority::Low) {
assert!(self.low_pri_cache.insert(key, Some(value)).is_none());
debug_assert!(self.cache.get(&key).is_none());
debug_assert!(!self.cache.contains_key(&key));
} else {
assert!(self.cache.insert(key, Some(value)).is_none());
debug_assert!(self.low_pri_cache.get(&key).is_none());
debug_assert!(!self.low_pri_cache.contains_key(&key));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/tree_store/page_store/page_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,8 @@ impl TransactionalMemory {

fn grow(&self, state: &mut InMemoryState, required_order_allocation: u8) -> Result<()> {
let layout = state.header.layout();
let required_growth = 2u64.pow(required_order_allocation.try_into().unwrap())
* state.header.page_size() as u64;
let required_growth =
2u64.pow(required_order_allocation.into()) * state.header.page_size() as u64;
let max_region_size = (state.header.layout().full_region_layout().num_pages() as u64)
* (state.header.page_size() as u64);
let next_desired_size = if layout.num_full_regions() > 0 {
Expand Down

0 comments on commit e93051a

Please sign in to comment.