Skip to content

Commit

Permalink
Fix uninlined_format_args (#229)
Browse files Browse the repository at this point in the history
* Fix `uninlined_format_args`

* Update examples/iterator.rs
  • Loading branch information
saschanaz committed Oct 26, 2022
1 parent 374a71d commit 62a8cbd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
7 changes: 4 additions & 3 deletions examples/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ fn main() {
// returns the (key, value) tuples in order.
let mut iter = store.iter_start(&reader).unwrap();
while let Some(Ok((country, city))) = iter.next() {
println!("{}, {:?}", str::from_utf8(country).unwrap(), city);
let country = str::from_utf8(country).unwrap();
println!("{country}, {city:?}");
}

println!();
Expand All @@ -44,14 +45,14 @@ fn main() {
// than the given key.
let mut iter = store.iter_from(&reader, "Japan").unwrap();
while let Some(Ok((country, city))) = iter.next() {
println!("{}, {:?}", str::from_utf8(country).unwrap(), city);
println!("{}, {city:?}", str::from_utf8(country).unwrap());
}

println!();
println!("Iterating from the given prefix...");
let mut iter = store.iter_from(&reader, "Un").unwrap();
while let Some(Ok((country, city))) = iter.next() {
println!("{}, {:?}", str::from_utf8(country).unwrap(), city);
println!("{}, {city:?}", str::from_utf8(country).unwrap());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/backend/impl_lmdb/arch_migrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ impl Migrator {
out.write_all(b"VERSION=3\n")?;
out.write_all(b"format=bytevalue\n")?;
if let Some(database) = database {
writeln!(out, "database={}", database)?;
writeln!(out, "database={database}")?;
}
out.write_all(b"type=btree\n")?;
writeln!(out, "mapsize={}", meta_data.mm_mapsize)?;
Expand All @@ -556,12 +556,12 @@ impl Migrator {
for (key, value) in pairs {
out.write_all(b" ")?;
for byte in key {
write!(out, "{:02x}", byte)?;
write!(out, "{byte:02x}")?;
}
out.write_all(b"\n")?;
out.write_all(b" ")?;
for byte in value {
write!(out, "{:02x}", byte)?;
write!(out, "{byte:02x}")?;
}
out.write_all(b"\n")?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() -> Result<(), LmdbArchMigrateError> {
Some(str) => Some(str),
};
}
str => return Err(format!("arg -{} not recognized", str).into()),
str => return Err(format!("arg -{str} not recognized").into()),
}
} else {
if env_path.is_some() {
Expand Down
8 changes: 4 additions & 4 deletions tests/env-lmdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn test_open_from_builder_with_dir_1() {
#[should_panic(expected = "rkv: UnsuitableEnvironmentPath(\"bogus\")")]
fn test_open_from_builder_with_dir_2() {
let root = Path::new("bogus");
println!("Root path: {:?}", root);
println!("Root path: {root:?}");
assert!(!root.is_dir());

let mut builder = Rkv::environment_builder::<Lmdb>();
Expand Down Expand Up @@ -897,10 +897,10 @@ fn test_concurrent_read_transactions_prohibited() {

match second {
Err(StoreError::ReadTransactionAlreadyExists(t)) => {
println!("Thread was {:?}", t);
println!("Thread was {t:?}");
}
Err(e) => {
println!("Got error {:?}", e);
println!("Got error {e:?}");
}
_ => {
panic!("Expected error.");
Expand Down Expand Up @@ -1045,7 +1045,7 @@ fn test_stat() {
let k = Rkv::new::<Lmdb>(root.path()).expect("new succeeded");
for i in 0..5 {
let sk = k
.open_integer(&format!("sk{}", i)[..], StoreOptions::create())
.open_integer(&format!("sk{i}")[..], StoreOptions::create())
.expect("opened");
{
let mut writer = k.write().expect("writer");
Expand Down
2 changes: 1 addition & 1 deletion tests/env-safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn test_open_from_builder_with_dir_safe_1() {
#[should_panic(expected = "rkv: UnsuitableEnvironmentPath(\"bogus\")")]
fn test_open_from_builder_with_dir_safe_2() {
let root = Path::new("bogus");
println!("Root path: {:?}", root);
println!("Root path: {root:?}");
assert!(!root.is_dir());

let mut builder = Rkv::environment_builder::<SafeMode>();
Expand Down
16 changes: 8 additions & 8 deletions tests/test_txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,35 @@ fn read_many() {
let mut writer = k.write().expect("env write lock");

for id in 0..30_u64 {
let value = format!("value{}", id);
let date = format!("2019-06-{}", id);
let value = format!("value{id}");
let date = format!("2019-06-{id}");
put_id_field(&mut writer, datestore, &date, id);
put_id_field(&mut writer, valuestore, &value, id);
put_sample(&mut writer, samplestore, id, &value);
}

// now we read in the same transaction
for id in 0..30_u64 {
let value = format!("value{}", id);
let date = format!("2019-06-{}", id);
let value = format!("value{id}");
let date = format!("2019-06-{id}");
let ids = get_ids_by_field(&writer, datestore, &date);
let ids2 = get_ids_by_field(&writer, valuestore, &value);
let samples = get_samples(&writer, samplestore, &ids);
let samples2 = get_samples(&writer, samplestore, &ids2);
println!("{:?}, {:?}", samples, samples2);
println!("{samples:?}, {samples2:?}");
}
}

{
let reader = k.read().expect("env read lock");
for id in 0..30_u64 {
let value = format!("value{}", id);
let date = format!("2019-06-{}", id);
let value = format!("value{id}");
let date = format!("2019-06-{id}");
let ids = get_ids_by_field(&reader, datestore, &date);
let ids2 = get_ids_by_field(&reader, valuestore, &value);
let samples = get_samples(&reader, samplestore, &ids);
let samples2 = get_samples(&reader, samplestore, &ids2);
println!("{:?}, {:?}", samples, samples2);
println!("{samples:?}, {samples2:?}");
}
}
}
Expand Down

0 comments on commit 62a8cbd

Please sign in to comment.