Mercurial > lbo > hg > leveldb-rs
changeset 488:b99076512068
Remove compiler warnings about implicit trait types (`dyn`)
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 30 Aug 2019 13:31:39 +0200 |
parents | 76562348cb17 |
children | 0130b5d5e8c7 |
files | src/cmp.rs src/db_impl.rs src/db_iter.rs src/disk_env.rs src/env.rs src/filter.rs src/infolog.rs src/key_types.rs src/mem_env.rs src/memtable.rs src/merging_iter.rs src/options.rs src/skipmap.rs src/table_block.rs src/table_reader.rs src/types.rs src/version.rs src/version_set.rs |
diffstat | 18 files changed, 69 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cmp.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/cmp.rs Fri Aug 30 13:31:39 2019 +0200 @@ -4,7 +4,7 @@ use std::cmp::Ordering; use std::rc::Rc; -type WrappedCmp = Rc<Box<Cmp>>; +type WrappedCmp = Rc<Box<dyn Cmp>>; /// Comparator trait, supporting types that can be nested (i.e., add additional functionality on /// top of an inner comparator) @@ -105,7 +105,7 @@ /// Same as memtable_key_cmp, but for InternalKeys. #[derive(Clone)] -pub struct InternalKeyCmp(pub Rc<Box<Cmp>>); +pub struct InternalKeyCmp(pub Rc<Box<dyn Cmp>>); impl Cmp for InternalKeyCmp { fn cmp(&self, a: &[u8], b: &[u8]) -> Ordering { @@ -154,7 +154,7 @@ /// ordering the sequence numbers. (This means that when having an entry abx/4 and seRching for /// abx/5, then abx/4 is counted as "greater-or-equal", making snapshot functionality work at all) #[derive(Clone)] -pub struct MemtableKeyCmp(pub Rc<Box<Cmp>>); +pub struct MemtableKeyCmp(pub Rc<Box<dyn Cmp>>); impl Cmp for MemtableKeyCmp { fn cmp(&self, a: &[u8], b: &[u8]) -> Ordering {
--- a/src/db_impl.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/db_impl.rs Fri Aug 30 13:31:39 2019 +0200 @@ -43,14 +43,14 @@ name: PathBuf, lock: Option<FileLock>, - internal_cmp: Rc<Box<Cmp>>, + internal_cmp: Rc<Box<dyn Cmp>>, fpol: InternalFilterPolicy<BoxedFilterPolicy>, opt: Options, mem: MemTable, imm: Option<MemTable>, - log: Option<LogWriter<BufWriter<Box<Write>>>>, + log: Option<LogWriter<BufWriter<Box<dyn Write>>>>, log_num: Option<FileNum>, cache: Shared<TableCache>, vset: Shared<VersionSet>, @@ -227,7 +227,7 @@ let filename = log_file_name(&self.name, log_num); let logfile = self.opt.env.open_sequential_file(Path::new(&filename))?; // Use the user-supplied comparator; it will be wrapped inside a MemtableKeyCmp. - let cmp: Rc<Box<Cmp>> = self.opt.cmp.clone(); + let cmp: Rc<Box<dyn Cmp>> = self.opt.cmp.clone(); let mut logreader = LogReader::new( logfile, // checksum= @@ -496,7 +496,7 @@ /// merge_iterators produces a MergingIter merging the entries in the memtable, the immutable /// memtable, and table files from all levels. fn merge_iterators(&mut self) -> Result<MergingIter> { - let mut iters: Vec<Box<LdbIterator>> = vec![]; + let mut iters: Vec<Box<dyn LdbIterator>> = vec![]; if self.mem.len() > 0 { iters.push(Box::new(self.mem.iter())); } @@ -942,7 +942,7 @@ compaction: Compaction, smallest_seq: SequenceNumber, outputs: Vec<FileMetaData>, - builder: Option<TableBuilder<Box<Write>>>, + builder: Option<TableBuilder<Box<dyn Write>>>, total_bytes: usize, } @@ -963,7 +963,7 @@ } /// cleanup cleans up after an aborted compaction. - fn cleanup<P: AsRef<Path>>(&mut self, env: &Box<Env>, name: P) { + fn cleanup<P: AsRef<Path>>(&mut self, env: &Box<dyn Env>, name: P) { for o in self.outputs.drain(..) { let name = table_file_name(name.as_ref(), o.num); let _ = env.delete(&name); @@ -1624,7 +1624,7 @@ #[test] fn test_db_impl_compaction_state_cleanup() { - let env: Box<Env> = Box::new(MemEnv::new()); + let env: Box<dyn Env> = Box::new(MemEnv::new()); let name = "db"; let stuff = "abcdefghijkl".as_bytes();
--- a/src/db_iter.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/db_iter.rs Fri Aug 30 13:31:39 2019 +0200 @@ -16,7 +16,7 @@ /// DBIterator is an iterator over the contents of a database. pub struct DBIterator { // A user comparator. - cmp: Rc<Box<Cmp>>, + cmp: Rc<Box<dyn Cmp>>, vset: Shared<VersionSet>, iter: MergingIter, // By holding onto a snapshot, we make sure that the iterator iterates over the state at the @@ -36,7 +36,7 @@ impl DBIterator { pub fn new( - cmp: Rc<Box<Cmp>>, + cmp: Rc<Box<dyn Cmp>>, vset: Shared<VersionSet>, iter: MergingIter, ss: Snapshot,
--- a/src/disk_env.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/disk_env.rs Fri Aug 30 13:31:39 2019 +0200 @@ -41,7 +41,7 @@ // Note: We're using Ok(f()?) in several locations below in order to benefit from the automatic // error conversion using std::convert::From. impl Env for PosixDiskEnv { - fn open_sequential_file(&self, p: &Path) -> Result<Box<Read>> { + fn open_sequential_file(&self, p: &Path) -> Result<Box<dyn Read>> { Ok(Box::new( fs::OpenOptions::new() .read(true) @@ -49,17 +49,17 @@ .map_err(|e| map_err_with_name("open (seq)", p, e))?, )) } - fn open_random_access_file(&self, p: &Path) -> Result<Box<RandomAccess>> { + fn open_random_access_file(&self, p: &Path) -> Result<Box<dyn RandomAccess>> { Ok(fs::OpenOptions::new() .read(true) .open(p) .map(|f| { - let b: Box<RandomAccess> = Box::new(f); + let b: Box<dyn RandomAccess> = Box::new(f); b }) .map_err(|e| map_err_with_name("open (randomaccess)", p, e))?) } - fn open_writable_file(&self, p: &Path) -> Result<Box<Write>> { + fn open_writable_file(&self, p: &Path) -> Result<Box<dyn Write>> { Ok(Box::new( fs::OpenOptions::new() .create(true) @@ -69,7 +69,7 @@ .map_err(|e| map_err_with_name("open (write)", p, e))?, )) } - fn open_appendable_file(&self, p: &Path) -> Result<Box<Write>> { + fn open_appendable_file(&self, p: &Path) -> Result<Box<dyn Write>> { Ok(Box::new( fs::OpenOptions::new() .create(true)
--- a/src/env.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/env.rs Fri Aug 30 13:31:39 2019 +0200 @@ -14,7 +14,7 @@ impl RandomAccess for File { fn read_at(&self, off: usize, dst: &mut [u8]) -> Result<usize> { - Ok((self as &FileExt).read_at(dst, off as u64)?) + Ok((self as &dyn FileExt).read_at(dst, off as u64)?) } } @@ -23,10 +23,10 @@ } pub trait Env { - fn open_sequential_file(&self, &Path) -> Result<Box<Read>>; - fn open_random_access_file(&self, &Path) -> Result<Box<RandomAccess>>; - fn open_writable_file(&self, &Path) -> Result<Box<Write>>; - fn open_appendable_file(&self, &Path) -> Result<Box<Write>>; + fn open_sequential_file(&self, &Path) -> Result<Box<dyn Read>>; + fn open_random_access_file(&self, &Path) -> Result<Box<dyn RandomAccess>>; + fn open_writable_file(&self, &Path) -> Result<Box<dyn Write>>; + fn open_appendable_file(&self, &Path) -> Result<Box<dyn Write>>; fn exists(&self, &Path) -> Result<bool>; fn children(&self, &Path) -> Result<Vec<PathBuf>>; @@ -47,11 +47,11 @@ } pub struct Logger { - dst: Box<Write>, + dst: Box<dyn Write>, } impl Logger { - pub fn new(w: Box<Write>) -> Logger { + pub fn new(w: Box<dyn Write>) -> Logger { Logger { dst: w } }
--- a/src/filter.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/filter.rs Fri Aug 30 13:31:39 2019 +0200 @@ -17,7 +17,7 @@ /// A boxed and refcounted filter policy (reference-counted because a Box with unsized content /// couldn't be cloned otherwise) -pub type BoxedFilterPolicy = Rc<Box<FilterPolicy>>; +pub type BoxedFilterPolicy = Rc<Box<dyn FilterPolicy>>; impl FilterPolicy for BoxedFilterPolicy { fn name(&self) -> &'static str {
--- a/src/infolog.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/infolog.rs Fri Aug 30 13:31:39 2019 +0200 @@ -1,6 +1,6 @@ use std::io::{self, Write}; -pub struct Logger(pub Box<Write>); +pub struct Logger(pub Box<dyn Write>); pub fn stderr() -> Logger { Logger(Box::new(io::stderr()))
--- a/src/key_types.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/key_types.rs Fri Aug 30 13:31:39 2019 +0200 @@ -152,7 +152,7 @@ } /// cmp_memtable_key efficiently compares two memtable keys by only parsing what's actually needed. -pub fn cmp_memtable_key<'a, 'b>(ucmp: &Cmp, a: MemtableKey<'a>, b: MemtableKey<'b>) -> Ordering { +pub fn cmp_memtable_key<'a, 'b>(ucmp: &dyn Cmp, a: MemtableKey<'a>, b: MemtableKey<'b>) -> Ordering { let (alen, aoff): (usize, usize) = VarInt::decode_var(&a); let (blen, boff): (usize, usize) = VarInt::decode_var(&b); let userkey_a = &a[aoff..aoff + alen - 8]; @@ -185,7 +185,7 @@ /// cmp_internal_key efficiently compares keys in InternalKey format by only parsing the parts that /// are actually needed for a comparison. -pub fn cmp_internal_key<'a, 'b>(ucmp: &Cmp, a: InternalKey<'a>, b: InternalKey<'b>) -> Ordering { +pub fn cmp_internal_key<'a, 'b>(ucmp: &dyn Cmp, a: InternalKey<'a>, b: InternalKey<'b>) -> Ordering { match ucmp.cmp(&a[0..a.len() - 8], &b[0..b.len() - 8]) { Ordering::Less => Ordering::Less, Ordering::Greater => Ordering::Greater,
--- a/src/mem_env.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/mem_env.rs Fri Aug 30 13:31:39 2019 +0200 @@ -158,7 +158,7 @@ } } /// Open a file for writing. - fn open_w(&self, p: &Path, append: bool, truncate: bool) -> Result<Box<Write>> { + fn open_w(&self, p: &Path, append: bool, truncate: bool) -> Result<Box<dyn Write>> { let f = self.open(p, true)?; if truncate { f.0.lock().unwrap().clear(); @@ -281,19 +281,19 @@ } impl Env for MemEnv { - fn open_sequential_file(&self, p: &Path) -> Result<Box<Read>> { + fn open_sequential_file(&self, p: &Path) -> Result<Box<dyn Read>> { let f = self.0.open(p, false)?; Ok(Box::new(MemFileReader::new(f, 0))) } - fn open_random_access_file(&self, p: &Path) -> Result<Box<RandomAccess>> { + fn open_random_access_file(&self, p: &Path) -> Result<Box<dyn RandomAccess>> { self.0 .open(p, false) - .map(|m| Box::new(m) as Box<RandomAccess>) + .map(|m| Box::new(m) as Box<dyn RandomAccess>) } - fn open_writable_file(&self, p: &Path) -> Result<Box<Write>> { + fn open_writable_file(&self, p: &Path) -> Result<Box<dyn Write>> { self.0.open_w(p, true, true) } - fn open_appendable_file(&self, p: &Path) -> Result<Box<Write>> { + fn open_appendable_file(&self, p: &Path) -> Result<Box<dyn Write>> { self.0.open_w(p, true, false) }
--- a/src/memtable.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/memtable.rs Fri Aug 30 13:31:39 2019 +0200 @@ -17,12 +17,12 @@ impl MemTable { /// Returns a new MemTable. /// This wraps opt.cmp inside a MemtableKey-specific comparator. - pub fn new(cmp: Rc<Box<Cmp>>) -> MemTable { + pub fn new(cmp: Rc<Box<dyn Cmp>>) -> MemTable { MemTable::new_raw(Rc::new(Box::new(MemtableKeyCmp(cmp)))) } /// Doesn't wrap the comparator in a MemtableKeyCmp. - fn new_raw(cmp: Rc<Box<Cmp>>) -> MemTable { + fn new_raw(cmp: Rc<Box<dyn Cmp>>) -> MemTable { MemTable { map: SkipMap::new(cmp), }
--- a/src/merging_iter.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/merging_iter.rs Fri Aug 30 13:31:39 2019 +0200 @@ -17,15 +17,15 @@ } pub struct MergingIter { - iters: Vec<Box<LdbIterator>>, + iters: Vec<Box<dyn LdbIterator>>, current: Option<usize>, direction: Direction, - cmp: Rc<Box<Cmp>>, + cmp: Rc<Box<dyn Cmp>>, } impl MergingIter { /// Construct a new merging iterator. - pub fn new(cmp: Rc<Box<Cmp>>, iters: Vec<Box<LdbIterator>>) -> MergingIter { + pub fn new(cmp: Rc<Box<dyn Cmp>>, iters: Vec<Box<dyn LdbIterator>>) -> MergingIter { let mi = MergingIter { iters: iters, current: None,
--- a/src/options.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/options.rs Fri Aug 30 13:31:39 2019 +0200 @@ -39,8 +39,8 @@ /// Note: Compression is not yet implemented. #[derive(Clone)] pub struct Options { - pub cmp: Rc<Box<Cmp>>, - pub env: Rc<Box<Env>>, + pub cmp: Rc<Box<dyn Cmp>>, + pub env: Rc<Box<dyn Env>>, pub log: Option<Shared<Logger>>, pub create_if_missing: bool, pub error_if_exists: bool,
--- a/src/skipmap.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/skipmap.rs Fri Aug 30 13:31:39 2019 +0200 @@ -30,7 +30,7 @@ len: usize, // approximation of memory used. approx_mem: usize, - cmp: Rc<Box<Cmp>>, + cmp: Rc<Box<dyn Cmp>>, } pub struct SkipMap { @@ -39,12 +39,12 @@ impl SkipMap { /// Returns a SkipMap that wraps the comparator inside a MemtableKeyCmp. - pub fn new_memtable_map(cmp: Rc<Box<Cmp>>) -> SkipMap { + pub fn new_memtable_map(cmp: Rc<Box<dyn Cmp>>) -> SkipMap { SkipMap::new(Rc::new(Box::new(MemtableKeyCmp(cmp)))) } /// Returns a SkipMap that uses the specified comparator. - pub fn new(cmp: Rc<Box<Cmp>>) -> SkipMap { + pub fn new(cmp: Rc<Box<dyn Cmp>>) -> SkipMap { let mut s = Vec::new(); s.resize(MAX_HEIGHT, None); @@ -475,7 +475,7 @@ #[test] fn test_empty_skipmap_find_memtable_cmp() { // Regression test: Make sure comparator isn't called with empty key. - let cmp: Rc<Box<Cmp>> = Rc::new(Box::new(MemtableKeyCmp(options::for_test().cmp))); + let cmp: Rc<Box<dyn Cmp>> = Rc::new(Box::new(MemtableKeyCmp(options::for_test().cmp))); let skm = SkipMap::new(cmp); let mut it = skm.iter();
--- a/src/table_block.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/table_block.rs Fri Aug 30 13:31:39 2019 +0200 @@ -13,14 +13,14 @@ use snap::Decoder; /// Reads the data for the specified block handle from a file. -fn read_bytes(f: &RandomAccess, location: &BlockHandle) -> Result<Vec<u8>> { +fn read_bytes(f: &dyn RandomAccess, location: &BlockHandle) -> Result<Vec<u8>> { let mut buf = vec![0; location.size()]; f.read_at(location.offset(), &mut buf).map(|_| buf) } /// Reads a serialized filter block from a file and returns a FilterBlockReader. pub fn read_filter_block( - src: &RandomAccess, + src: &dyn RandomAccess, location: &BlockHandle, policy: filter::BoxedFilterPolicy, ) -> Result<FilterBlockReader> { @@ -37,7 +37,7 @@ /// Reads a table block from a random-access source. /// A table block consists of [bytes..., compress (1B), checksum (4B)]; the handle only refers to /// the location and length of [bytes...]. -pub fn read_table_block(opt: Options, f: &RandomAccess, location: &BlockHandle) -> Result<Block> { +pub fn read_table_block(opt: Options, f: &dyn RandomAccess, location: &BlockHandle) -> Result<Block> { // The block is denoted by offset and length in BlockHandle. A block in an encoded // table is followed by 1B compression type and 4B checksum. // The checksum refers to the compressed contents.
--- a/src/table_reader.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/table_reader.rs Fri Aug 30 13:31:39 2019 +0200 @@ -18,7 +18,7 @@ use integer_encoding::FixedIntWriter; /// Reads the table footer. -fn read_footer(f: &RandomAccess, size: usize) -> Result<Footer> { +fn read_footer(f: &dyn RandomAccess, size: usize) -> Result<Footer> { let mut buf = vec![0; table_builder::FULL_FOOTER_LENGTH]; f.read_at(size - table_builder::FULL_FOOTER_LENGTH, &mut buf)?; Ok(Footer::decode(&buf)) @@ -26,7 +26,7 @@ #[derive(Clone)] pub struct Table { - file: Rc<Box<RandomAccess>>, + file: Rc<Box<dyn RandomAccess>>, file_size: usize, cache_id: cache::CacheID, @@ -39,7 +39,7 @@ impl Table { /// Creates a new table reader operating on unformatted keys (i.e., UserKey). - fn new_raw(opt: Options, file: Rc<Box<RandomAccess>>, size: usize) -> Result<Table> { + fn new_raw(opt: Options, file: Rc<Box<dyn RandomAccess>>, size: usize) -> Result<Table> { let footer = try!(read_footer(file.as_ref().as_ref(), size)); let indexblock = try!(table_block::read_table_block( opt.clone(), @@ -69,7 +69,7 @@ fn read_filter_block( metaix: &Block, - file: &RandomAccess, + file: &dyn RandomAccess, options: &Options, ) -> Result<Option<FilterBlockReader>> { // Open filter block for reading @@ -96,7 +96,7 @@ /// Creates a new table reader operating on internal keys (i.e., InternalKey). This means that /// a different comparator (internal_key_cmp) and a different filter policy /// (InternalFilterPolicy) are used. - pub fn new(mut opt: Options, file: Rc<Box<RandomAccess>>, size: usize) -> Result<Table> { + pub fn new(mut opt: Options, file: Rc<Box<dyn RandomAccess>>, size: usize) -> Result<Table> { opt.cmp = Rc::new(Box::new(InternalKeyCmp(opt.cmp.clone()))); opt.filter_policy = Rc::new(Box::new(filter::InternalFilterPolicy::new( opt.filter_policy, @@ -442,7 +442,7 @@ (d, size) } - fn wrap_buffer(src: Vec<u8>) -> Rc<Box<RandomAccess>> { + fn wrap_buffer(src: Vec<u8>) -> Rc<Box<dyn RandomAccess>> { Rc::new(Box::new(src)) }
--- a/src/types.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/types.rs Fri Aug 30 13:31:39 2019 +0200 @@ -93,7 +93,7 @@ } } -impl LdbIterator for Box<LdbIterator> { +impl LdbIterator for Box<dyn LdbIterator> { fn advance(&mut self) -> bool { self.as_mut().advance() }
--- a/src/version.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/version.rs Fri Aug 30 13:31:39 2019 +0200 @@ -22,7 +22,7 @@ pub struct Version { table_cache: Shared<TableCache>, - user_cmp: Rc<Box<Cmp>>, + user_cmp: Rc<Box<dyn Cmp>>, pub files: [Vec<FileMetaHandle>; NUM_LEVELS], pub file_to_compact: Option<FileMetaHandle>, @@ -32,7 +32,7 @@ } impl Version { - pub fn new(cache: Shared<TableCache>, ucmp: Rc<Box<Cmp>>) -> Version { + pub fn new(cache: Shared<TableCache>, ucmp: Rc<Box<dyn Cmp>>) -> Version { Version { table_cache: cache, user_cmp: ucmp, @@ -360,8 +360,8 @@ /// new_iters returns a set of iterators that can be merged to yield all entries in this /// version. - pub fn new_iters(&self) -> Result<Vec<Box<LdbIterator>>> { - let mut iters: Vec<Box<LdbIterator>> = vec![]; + pub fn new_iters(&self) -> Result<Vec<Box<dyn LdbIterator>>> { + let mut iters: Vec<Box<dyn LdbIterator>> = vec![]; for f in &self.files[0] { iters.push(Box::new( self.table_cache @@ -386,7 +386,7 @@ pub fn new_version_iter( files: Vec<FileMetaHandle>, cache: Shared<TableCache>, - ucmp: Rc<Box<Cmp>>, + ucmp: Rc<Box<dyn Cmp>>, ) -> VersionIter { VersionIter { files: files, @@ -602,7 +602,7 @@ /// write_table creates a table with the given number and contents (must be sorted!) in the /// memenv. The sequence numbers given to keys start with startseq. pub fn write_table( - me: &Box<Env>, + me: &Box<dyn Env>, contents: &[(&[u8], &[u8], ValueType)], startseq: u64, num: FileNum,
--- a/src/version_set.rs Tue Aug 20 18:18:53 2019 +0200 +++ b/src/version_set.rs Fri Aug 30 13:31:39 2019 +0200 @@ -25,7 +25,7 @@ max_file_size: usize, input_version: Option<Shared<Version>>, level_ixs: [usize; NUM_LEVELS], - cmp: Rc<Box<Cmp>>, + cmp: Rc<Box<dyn Cmp>>, icmp: InternalKeyCmp, manual: bool, @@ -181,7 +181,7 @@ current: Option<Shared<Version>>, compaction_ptrs: [Vec<u8>; NUM_LEVELS], - descriptor_log: Option<LogWriter<Box<Write>>>, + descriptor_log: Option<LogWriter<Box<dyn Write>>>, } impl VersionSet { @@ -705,9 +705,9 @@ } /// make_input_iterator returns an iterator over the inputs of a compaction. - pub fn make_input_iterator(&self, c: &Compaction) -> Box<LdbIterator> { + pub fn make_input_iterator(&self, c: &Compaction) -> Box<dyn LdbIterator> { let cap = if c.level == 0 { c.num_inputs(0) + 1 } else { 2 }; - let mut iters: Vec<Box<LdbIterator>> = Vec::with_capacity(cap); + let mut iters: Vec<Box<dyn LdbIterator>> = Vec::with_capacity(cap); for i in 0..2 { if c.num_inputs(i) == 0 { continue; @@ -738,7 +738,7 @@ } } assert!(iters.len() <= cap); - let cmp: Rc<Box<Cmp>> = Rc::new(Box::new(self.cmp.clone())); + let cmp: Rc<Box<dyn Cmp>> = Rc::new(Box::new(self.cmp.clone())); Box::new(MergingIter::new(cmp, iters)) } } @@ -865,7 +865,7 @@ dbname.as_ref().join("CURRENT").to_owned() } -pub fn read_current_file(env: &Box<Env>, dbname: &Path) -> Result<String> { +pub fn read_current_file(env: &Box<dyn Env>, dbname: &Path) -> Result<String> { let mut current = String::new(); let mut f = env.open_sequential_file(Path::new(¤t_file_name(dbname)))?; f.read_to_string(&mut current)?; @@ -879,7 +879,7 @@ } pub fn set_current_file<P: AsRef<Path>>( - env: &Box<Env>, + env: &Box<dyn Env>, dbname: P, manifest_file_num: FileNum, ) -> Result<()> { @@ -1209,7 +1209,7 @@ /// iterator_properties tests that it contains len elements and that they are ordered in /// ascending order by cmp. - fn iterator_properties<It: LdbIterator>(mut it: It, len: usize, cmp: Rc<Box<Cmp>>) { + fn iterator_properties<It: LdbIterator>(mut it: It, len: usize, cmp: Rc<Box<dyn Cmp>>) { let mut wr = LdbIteratorIter::wrap(&mut it); let first = wr.next().unwrap(); let mut count = 1;