File tree Expand file tree Collapse file tree 4 files changed +3
-13
lines changed
Expand file tree Collapse file tree 4 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,7 @@ impl From<io::Error> for BuildDictionaryError {
433433}
434434
435435/// TODO: doc
436- pub trait DictionaryBuilder {
436+ pub trait DictionaryBuilder : Any {
437437 /// TODO: doc
438438 fn set_info ( & mut self , info : DictionaryInfo ) -> Result < ( ) , BuildDictionaryError > ;
439439 /// TODO: doc
@@ -444,7 +444,6 @@ pub trait DictionaryBuilder {
444444 ) -> Result < ( ) , BuildDictionaryError > ;
445445 /// TODO: doc
446446 fn build ( & mut self , path : & Path ) -> Result < ( ) , BuildDictionaryError > ;
447- fn as_any ( & self ) -> & dyn Any ;
448447}
449448
450449#[ cfg( test) ]
Original file line number Diff line number Diff line change 11use std:: {
2- any:: Any ,
32 error:: Error ,
43 fmt:: Display ,
54 path:: { Path , PathBuf } ,
@@ -577,10 +576,6 @@ impl DictionaryBuilder for SqliteDictionaryBuilder {
577576 self . dict . conn . execute ( "VACUUM INTO ?" , [ path] ) ?;
578577 Ok ( ( ) )
579578 }
580-
581- fn as_any ( & self ) -> & dyn Any {
582- self
583- }
584579}
585580
586581#[ cfg( test) ]
Original file line number Diff line number Diff line change 11use std:: {
2- any:: Any ,
32 cmp:: Ordering ,
43 collections:: VecDeque ,
54 error:: Error ,
@@ -1164,10 +1163,6 @@ impl DictionaryBuilder for TrieBuilder {
11641163 fs:: rename ( & tmpname, path) ?;
11651164 Ok ( ( ) )
11661165 }
1167-
1168- fn as_any ( & self ) -> & dyn Any {
1169- self
1170- }
11711166}
11721167
11731168impl Default for TrieBuilder {
Original file line number Diff line number Diff line change 11use std:: {
2+ any:: Any ,
23 error:: Error ,
34 fmt:: Display ,
45 fs:: { self , File } ,
@@ -156,7 +157,7 @@ pub(crate) fn run(args: flags::InitDatabase) -> Result<()> {
156157
157158 builder. build ( path) ?;
158159
159- if let Some ( trie_builder) = builder . as_any ( ) . downcast_ref :: < TrieBuilder > ( ) {
160+ if let Some ( trie_builder) = ( builder as Box < dyn Any > ) . downcast_ref :: < TrieBuilder > ( ) {
160161 let stats = trie_builder. statistics ( ) ;
161162 eprintln ! ( "== Trie Dictionary Statistics ==" ) ;
162163 eprintln ! ( "Name : {}" , info. name) ;
You can’t perform that action at this time.
0 commit comments