Skip to content
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: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
imports_granularity = "Crate"
imports_layout = "HorizontalVertical"
edition = "2021"
edition = "2024"
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ description = """Efficient string interner with minimal memory footprint
and fast access to the underlying strings.
"""
categories = ["data-structures"]
edition = "2021"
rust-version = "1.65.0"
edition = "2024"
rust-version = "1.85.0"

[dependencies]
hashbrown = { version = "0.16.0", default-features = false, features = ["default-hasher", "raw-entry"] }
hashbrown = { version = "0.17.0", default-features = false, features = ["default-hasher", "raw-entry"] }
serde = { version = "1.0", default-features = false, features = ["alloc"], optional = true }

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
mod setup;

use self::setup::{
generate_test_strings,
BENCH_LEN_STRINGS,
BENCH_STRING_LEN,
BackendBenchmark,
BenchBucket,
BenchBuffer,
BenchString,
BENCH_LEN_STRINGS,
BENCH_STRING_LEN,
generate_test_strings,
};
use criterion::{
criterion_group,
criterion_main,
measurement::WallTime,
BatchSize,
BenchmarkGroup,
Criterion,
Throughput,
criterion_group,
criterion_main,
measurement::WallTime,
};
use std::hint::black_box;
use string_interner::backend::Backend;
Expand Down
2 changes: 1 addition & 1 deletion benches/setup.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use string_interner::{
backend::{Backend, BucketBackend, BufferBackend, StringBackend},
DefaultSymbol,
StringInterner,
backend::{Backend, BucketBackend, BufferBackend, StringBackend},
};

/// Alphabet containing all characters that may be put into a benchmark string.
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod interned_str;

use self::{fixed_str::FixedString, interned_str::InternedStr};
use super::Backend;
use crate::{symbol::expect_valid_symbol, DefaultSymbol, Symbol};
use crate::{DefaultSymbol, Symbol, symbol::expect_valid_symbol};
use alloc::{string::String, vec::Vec};
use core::{iter::Enumerate, marker::PhantomData, slice};

Expand Down
2 changes: 1 addition & 1 deletion src/backend/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(feature = "backends")]

use super::Backend;
use crate::{symbol::expect_valid_symbol, DefaultSymbol, Symbol};
use crate::{DefaultSymbol, Symbol, symbol::expect_valid_symbol};
use alloc::vec::Vec;
use core::{marker::PhantomData, mem, str};

Expand Down
2 changes: 1 addition & 1 deletion src/backend/string.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(feature = "backends")]

use super::Backend;
use crate::{symbol::expect_valid_symbol, DefaultSymbol, Symbol};
use crate::{DefaultSymbol, Symbol, symbol::expect_valid_symbol};
use alloc::{string::String, vec::Vec};
use core::{iter::Enumerate, marker::PhantomData, slice};

Expand Down
2 changes: 1 addition & 1 deletion src/interner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{backend::Backend, Symbol};
use crate::{Symbol, backend::Backend};
use core::{
fmt,
fmt::{Debug, Formatter},
Expand Down
4 changes: 2 additions & 2 deletions src/serde_impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{backend::Backend, StringInterner, Symbol};
use crate::{StringInterner, Symbol, backend::Backend};
use alloc::boxed::Box;
use core::{default::Default, fmt, hash::BuildHasher, marker};
use serde::{
Expand Down Expand Up @@ -123,8 +123,8 @@ impl_serde_for_symbol!(SymbolUsize, usize);
#[cfg(test)]
mod tests {
use crate::{
symbol::{SymbolU16, SymbolU32, SymbolUsize},
Symbol,
symbol::{SymbolU16, SymbolU32, SymbolUsize},
};
use serde_json;

Expand Down
12 changes: 8 additions & 4 deletions tests/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ impl TracingAllocator {

unsafe impl GlobalAlloc for TracingAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
self.stats.push_allocations(layout);
self.inner.alloc(layout)
unsafe {
self.stats.push_allocations(layout);
self.inner.alloc(layout)
}
}

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
self.stats.push_deallocations(layout);
self.inner.dealloc(ptr, layout);
unsafe {
self.stats.push_deallocations(layout);
self.inner.dealloc(ptr, layout);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod allocator;

use allocator::TracingAllocator;
use string_interner::{backend, DefaultHashBuilder, DefaultSymbol, Symbol};
use string_interner::{DefaultHashBuilder, DefaultSymbol, Symbol, backend};

#[global_allocator]
static ALLOCATOR: TracingAllocator = TracingAllocator::new();
Expand Down
Loading