Suppress clippy

This commit is contained in:
Kitaiti Makoto 2021-01-07 16:38:28 +09:00
parent 16624fd742
commit a733ece26e
2 changed files with 22 additions and 18 deletions

View File

@ -21,13 +21,13 @@ impl Actor for SearchActor {
type Msg = PostEvent;
fn pre_start(&mut self, ctx: &Context<Self::Msg>) {
&POST_CHAN.tell(
POST_CHAN.tell(
Subscribe {
actor: Box::new(ctx.myself()),
topic: "*".into(),
},
None,
);
)
}
fn recv(&mut self, _ctx: &Context<Self::Msg>, msg: Self::Msg, _sender: Sender) {
@ -36,24 +36,30 @@ impl Actor for SearchActor {
match msg {
PostPublished(post) => {
let conn = self.conn.get();
if conn.is_ok() {
match conn {
Ok(_) => {
self.searcher
.add_document(&conn.unwrap(), &post)
.unwrap_or_else(|e| error!("{:?}", e));
} else {
},
_ => {
error!("Failed to get database connection");
}
}
}
PostUpdated(post) => {
let conn = self.conn.get();
if conn.is_ok() {
match conn {
Ok(_) => {
self.searcher
.update_document(&conn.unwrap(), &post)
.unwrap_or_else(|e| error!("{:?}", e));
} else {
},
_ => {
error!("Failed to get database connection");
}
}
}
PostDeleted(post) => self.searcher.delete_document(&post),
}
}

View File

@ -90,7 +90,7 @@ impl Searcher {
}
open_searcher = Self::open(path, tokenizers);
}
let searcher = match open_searcher {
match open_searcher {
Ok(s) => s,
Err(Error::Search(e)) => match e {
SearcherError::WriteLockAcquisitionError => panic!(
@ -118,9 +118,7 @@ Then try to restart Plume
e => Err(e).unwrap(),
},
_ => panic!("Unexpected error while opening search index"),
};
searcher
}
}
pub fn create(path: &dyn AsRef<Path>, tokenizers: &SearchTokenizerConfig) -> Result<Self> {