mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
clippy + fmt
This commit is contained in:
parent
d65f055030
commit
2665c0099d
@ -22,6 +22,7 @@ impl SearchAggregator {
|
||||
}
|
||||
|
||||
impl MockAnalytics {
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(opt: &Opt) -> (Arc<dyn Analytics>, String) {
|
||||
let user = find_user_id(&opt.db_path).unwrap_or_default();
|
||||
(Arc::new(Self), user)
|
||||
|
@ -119,11 +119,15 @@ impl super::Analytics for SegmentAnalytics {
|
||||
properties: send,
|
||||
..Default::default()
|
||||
};
|
||||
let _ = self.sender.try_send(AnalyticsMsg::BatchMessage(event.into()));
|
||||
let _ = self
|
||||
.sender
|
||||
.try_send(AnalyticsMsg::BatchMessage(event.into()));
|
||||
}
|
||||
|
||||
fn get_search(&self, aggregate: SearchAggregator) {
|
||||
let _ = self.sender.try_send(AnalyticsMsg::AggregateGetSearch(aggregate));
|
||||
let _ = self
|
||||
.sender
|
||||
.try_send(AnalyticsMsg::AggregateGetSearch(aggregate));
|
||||
}
|
||||
|
||||
fn post_search(&self, aggregate: SearchAggregator) {
|
||||
|
@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
let (analytics, user) = if !opt.no_analytics {
|
||||
analytics::SegmentAnalytics::new(&opt, &meilisearch).await
|
||||
} else {
|
||||
analytics::MockAnalytics::new(&opt)
|
||||
analytics::create_(&opt)
|
||||
};
|
||||
#[cfg(any(debug_assertions, not(feature = "analytics")))]
|
||||
let (analytics, user) = analytics::MockAnalytics::new(&opt);
|
||||
|
@ -16,7 +16,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
pub async fn create_dump(
|
||||
meilisearch: GuardedData<Private, MeiliSearch>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
analytics.publish("Dump Created".to_string(), json!({}), Some(&req));
|
||||
|
||||
|
@ -132,7 +132,7 @@ pub async fn add_documents(
|
||||
params: web::Query<UpdateDocumentsQuery>,
|
||||
body: Payload,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
debug!("called with params: {:?}", params);
|
||||
let content_type = req
|
||||
@ -164,7 +164,7 @@ pub async fn update_documents(
|
||||
params: web::Query<UpdateDocumentsQuery>,
|
||||
body: Payload,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
debug!("called with params: {:?}", params);
|
||||
let content_type = req
|
||||
|
@ -57,7 +57,7 @@ pub async fn create_index(
|
||||
meilisearch: GuardedData<Private, MeiliSearch>,
|
||||
body: web::Json<IndexCreateRequest>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let body = body.into_inner();
|
||||
|
||||
@ -101,7 +101,7 @@ pub async fn update_index(
|
||||
path: web::Path<IndexParam>,
|
||||
body: web::Json<UpdateIndexRequest>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
debug!("called with params: {:?}", body);
|
||||
let body = body.into_inner();
|
||||
|
@ -111,7 +111,7 @@ pub async fn search_with_url_query(
|
||||
path: web::Path<IndexParam>,
|
||||
params: web::Query<SearchQueryGet>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
debug!("called with params: {:?}", params);
|
||||
let query: SearchQuery = params.into_inner().into();
|
||||
@ -138,7 +138,7 @@ pub async fn search_with_post(
|
||||
path: web::Path<IndexParam>,
|
||||
params: web::Json<SearchQuery>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let query = params.into_inner();
|
||||
debug!("search called with params: {:?}", query);
|
||||
|
@ -43,7 +43,7 @@ macro_rules! make_setting_route {
|
||||
index_uid: actix_web::web::Path<String>,
|
||||
body: actix_web::web::Json<Option<$type>>,
|
||||
req: HttpRequest,
|
||||
$analytics_var: web::Data<&'static dyn Analytics>,
|
||||
$analytics_var: web::Data< dyn Analytics>,
|
||||
) -> std::result::Result<HttpResponse, ResponseError> {
|
||||
let body = body.into_inner();
|
||||
|
||||
@ -230,7 +230,7 @@ pub async fn update_all(
|
||||
index_uid: web::Path<String>,
|
||||
body: web::Json<Settings<Unchecked>>,
|
||||
req: HttpRequest,
|
||||
analytics: web::Data<&'static dyn Analytics>,
|
||||
analytics: web::Data<dyn Analytics>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let settings = body.into_inner();
|
||||
|
||||
|
@ -15,7 +15,7 @@ impl Service {
|
||||
&self.meilisearch,
|
||||
true,
|
||||
&self.options,
|
||||
analytics::MockAnalytics::new(&self.options)
|
||||
analytics::MockAnalytics::new(&self.options).0
|
||||
))
|
||||
.await;
|
||||
|
||||
@ -41,7 +41,7 @@ impl Service {
|
||||
&self.meilisearch,
|
||||
true,
|
||||
&self.options,
|
||||
analytics::MockAnalytics::new(&self.options)
|
||||
analytics::MockAnalytics::new(&self.options).0
|
||||
))
|
||||
.await;
|
||||
|
||||
@ -63,7 +63,7 @@ impl Service {
|
||||
&self.meilisearch,
|
||||
true,
|
||||
&self.options,
|
||||
analytics::MockAnalytics::new(&self.options)
|
||||
analytics::MockAnalytics::new(&self.options).0
|
||||
))
|
||||
.await;
|
||||
|
||||
@ -81,7 +81,7 @@ impl Service {
|
||||
&self.meilisearch,
|
||||
true,
|
||||
&self.options,
|
||||
analytics::MockAnalytics::new(&self.options)
|
||||
analytics::MockAnalytics::new(&self.options).0
|
||||
))
|
||||
.await;
|
||||
|
||||
@ -102,7 +102,7 @@ impl Service {
|
||||
&self.meilisearch,
|
||||
true,
|
||||
&self.options,
|
||||
analytics::MockAnalytics::new(&self.options)
|
||||
analytics::MockAnalytics::new(&self.options).0
|
||||
))
|
||||
.await;
|
||||
|
||||
|
@ -41,7 +41,7 @@ async fn error_json_bad_content_type() {
|
||||
&server.service.meilisearch,
|
||||
true,
|
||||
&server.service.options,
|
||||
analytics::MockAnalytics::new(&server.service.options)
|
||||
analytics::MockAnalytics::new(&server.service.options).0
|
||||
))
|
||||
.await;
|
||||
for route in routes {
|
||||
|
@ -20,7 +20,7 @@ async fn add_documents_test_json_content_types() {
|
||||
&server.service.meilisearch,
|
||||
true,
|
||||
&server.service.options,
|
||||
analytics::MockAnalytics::new(&server.service.options)
|
||||
analytics::MockAnalytics::new(&server.service.options).0
|
||||
))
|
||||
.await;
|
||||
// post
|
||||
@ -65,7 +65,7 @@ async fn error_add_documents_test_bad_content_types() {
|
||||
&server.service.meilisearch,
|
||||
true,
|
||||
&server.service.options,
|
||||
analytics::MockAnalytics::new(&server.service.options)
|
||||
analytics::MockAnalytics::new(&server.service.options).0
|
||||
))
|
||||
.await;
|
||||
// post
|
||||
@ -132,7 +132,7 @@ async fn error_add_documents_test_no_content_type() {
|
||||
&server.service.meilisearch,
|
||||
true,
|
||||
&server.service.options,
|
||||
analytics::MockAnalytics::new(&server.service.options)
|
||||
analytics::MockAnalytics::new(&server.service.options).0
|
||||
))
|
||||
.await;
|
||||
// post
|
||||
|
Loading…
Reference in New Issue
Block a user