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

Make current Clippy happy #807

Merged
merged 1 commit into from
May 10, 2024
Merged
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
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
Loading