From b3cdcda887a26cc8474adb6dc8f2b996c5f71b19 Mon Sep 17 00:00:00 2001 From: Johannes Hutter Date: Fri, 17 Nov 2023 11:48:51 +0100 Subject: [PATCH] Make static lifetime of constants explicit The most recent version of clippy complains about missing explicit lifetime annotators for constants. --- src/generator.rs | 2 +- src/package/store.rs | 4 ++-- tests/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/generator.rs b/src/generator.rs index f6c940fa..4d23435a 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -53,7 +53,7 @@ pub enum Generator { impl Generator { /// Tonic include file name - pub const TONIC_INCLUDE_FILE: &str = "buffrs.rs"; + pub const TONIC_INCLUDE_FILE: &'static str = "buffrs.rs"; /// Run the generator for a dependency and output files at the provided path pub async fn run(&self) -> miette::Result<()> { diff --git a/src/package/store.rs b/src/package/store.rs index 2e11e5f7..3fd9f54f 100644 --- a/src/package/store.rs +++ b/src/package/store.rs @@ -35,9 +35,9 @@ pub struct PackageStore { impl PackageStore { /// Path to the proto directory - pub const PROTO_PATH: &str = "proto"; + pub const PROTO_PATH: &'static str = "proto"; /// Path to the dependency store - pub const PROTO_VENDOR_PATH: &str = "proto/vendor"; + pub const PROTO_VENDOR_PATH: &'static str = "proto/vendor"; fn new(root: PathBuf) -> Self { Self { root } diff --git a/tests/lib.rs b/tests/lib.rs index 22d3199b..bcebe30f 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -31,8 +31,8 @@ pub struct VirtualFileSystem { } impl VirtualFileSystem { - const VIRTUAL_HOME: &str = "$HOME"; - const ROOT_NAME: &str = "root"; + const VIRTUAL_HOME: &'static str = "$HOME"; + const ROOT_NAME: &'static str = "root"; /// Init an empty virtual file system pub fn empty() -> Self {