Fix some of the edition 2024 warnings

This commit is contained in:
Clément Renault 2025-04-01 12:21:33 +02:00
parent 2762d5a32a
commit aa87064a13
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
82 changed files with 323 additions and 317 deletions

View file

@ -63,7 +63,7 @@ impl Encoder {
buffer
}
pub fn header(self: &Encoder) -> Option<impl TryIntoHeaderPair> {
pub fn header(self: &Encoder) -> Option<impl TryIntoHeaderPair + use<>> {
match self {
Self::Plain => None,
Self::Gzip => Some(("Content-Encoding", "gzip")),

View file

@ -25,13 +25,13 @@ pub struct Value(pub serde_json::Value);
impl Value {
#[track_caller]
pub fn uid(&self) -> u64 {
if let Some(uid) = self["uid"].as_u64() {
match self["uid"].as_u64() { Some(uid) => {
uid
} else if let Some(uid) = self["taskUid"].as_u64() {
} _ => { match self["taskUid"].as_u64() { Some(uid) => {
uid
} else {
} _ => {
panic!("Didn't find any task id in: {self}");
}
}}}}
}
pub fn has_uid(&self) -> bool {
@ -150,7 +150,7 @@ macro_rules! json {
/// Performs a search test on both post and get routes
#[macro_export]
macro_rules! test_post_get_search {
($server:expr, $query:expr, |$response:ident, $status_code:ident | $block:expr) => {
($server:expr_2021, $query:expr_2021, |$response:ident, $status_code:ident | $block:expr_2021) => {
let post_query: meilisearch::routes::search::SearchQueryPost =
serde_json::from_str(&$query.clone().to_string()).unwrap();
let get_query: meilisearch::routes::search::SearchQuery = post_query.into();

View file

@ -43,9 +43,11 @@ impl Server<Owned> {
let dir = TempDir::new().unwrap();
if cfg!(windows) {
std::env::set_var("TMP", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMP", TEST_TEMP_DIR.path()) };
} else {
std::env::set_var("TMPDIR", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMPDIR", TEST_TEMP_DIR.path()) };
}
let options = default_settings(dir.path());
@ -58,9 +60,11 @@ impl Server<Owned> {
pub async fn new_auth_with_options(mut options: Opt, dir: TempDir) -> Self {
if cfg!(windows) {
std::env::set_var("TMP", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMP", TEST_TEMP_DIR.path()) };
} else {
std::env::set_var("TMPDIR", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMPDIR", TEST_TEMP_DIR.path()) };
}
options.master_key = Some("MASTER_KEY".to_string());
@ -191,9 +195,11 @@ impl Server<Shared> {
let dir = TempDir::new().unwrap();
if cfg!(windows) {
std::env::set_var("TMP", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMP", TEST_TEMP_DIR.path()) };
} else {
std::env::set_var("TMPDIR", TEST_TEMP_DIR.path());
// TODO: Audit that the environment access only happens in single-threaded code.
unsafe { std::env::set_var("TMPDIR", TEST_TEMP_DIR.path()) };
}
let options = default_settings(dir.path());
@ -296,9 +302,9 @@ impl<State> Server<State> {
&self,
) -> impl actix_web::dev::Service<
actix_http::Request,
Response = ServiceResponse<impl MessageBody>,
Response = ServiceResponse<impl MessageBody + use<State>>,
Error = actix_web::Error,
> {
> + use<State> {
self.service.init_web_app().await
}

View file

@ -116,9 +116,9 @@ impl Service {
&self,
) -> impl actix_web::dev::Service<
actix_http::Request,
Response = ServiceResponse<impl MessageBody>,
Response = ServiceResponse<impl MessageBody + use<>>,
Error = actix_web::Error,
> {
> + use<> {
let (_route_layer, route_layer_handle) =
tracing_subscriber::reload::Layer::new(None.with_filter(
tracing_subscriber::filter::Targets::new().with_target("", LevelFilter::OFF),