Remove unneeded 'static lifetimes on &strs in constants (#8698)
This PR removes unneeded `'static` lifetimes on `&str`s stored in `const` declarations. This addresses some Clippy lints about [`redundant_static_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_static_lifetimes). In item-level `const` declarations we can rely on lifetime elision and use the default `'static` lifetime. Note that associated constants still require an explicit `'static` lifetime, as explained in https://github.com/rust-lang/rust/issues/115010. Release Notes: - N/A
This commit is contained in:
@@ -375,7 +375,7 @@ impl Database {
|
||||
}
|
||||
|
||||
fn is_serialization_error(error: &Error) -> bool {
|
||||
const SERIALIZATION_FAILURE_CODE: &'static str = "40001";
|
||||
const SERIALIZATION_FAILURE_CODE: &str = "40001";
|
||||
match error {
|
||||
Error::Database(
|
||||
DbErr::Exec(sea_orm::RuntimeErr::SqlxError(error))
|
||||
|
||||
@@ -37,8 +37,8 @@ async fn test_get_user_flags(db: &Arc<Database>) {
|
||||
.unwrap()
|
||||
.user_id;
|
||||
|
||||
const CHANNELS_ALPHA: &'static str = "channels-alpha";
|
||||
const NEW_SEARCH: &'static str = "new-search";
|
||||
const CHANNELS_ALPHA: &str = "channels-alpha";
|
||||
const NEW_SEARCH: &str = "new-search";
|
||||
|
||||
let channels_flag = db.create_user_flag(CHANNELS_ALPHA).await.unwrap();
|
||||
let search_flag = db.create_user_flag(NEW_SEARCH).await.unwrap();
|
||||
|
||||
@@ -20,7 +20,7 @@ use tracing_log::LogTracer;
|
||||
use tracing_subscriber::{filter::EnvFilter, fmt::format::JsonFields, Layer};
|
||||
use util::ResultExt;
|
||||
|
||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const REVISION: Option<&'static str> = option_env!("GITHUB_SHA");
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -2821,8 +2821,8 @@ async fn test_git_status_sync(
|
||||
)
|
||||
.await;
|
||||
|
||||
const A_TXT: &'static str = "a.txt";
|
||||
const B_TXT: &'static str = "b.txt";
|
||||
const A_TXT: &str = "a.txt";
|
||||
const B_TXT: &str = "b.txt";
|
||||
|
||||
client_a.fs().set_status_for_repo_via_git_operation(
|
||||
Path::new("/dir/.git"),
|
||||
|
||||
Reference in New Issue
Block a user