Skip to content

ビルド時のライフタイム省略に関する警告について #132

@kyutaze

Description

@kyutaze

事象

cargo buildまたはcargo build --release実行時に、以下のメッセージが出力されます:

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:45:30
   |
45 |     pub fn sakurazaka_config(&self) -> Result<Config<SClient>> {
   |                              ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                              |
   |                              the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
   = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
   |
45 |     pub fn sakurazaka_config(&self) -> Result<Config<'_, SClient>> {
   |                                                      +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:50:30
   |
50 |     pub fn hinatazaka_config(&self) -> Result<Config<HClient>> {
   |                              ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                              |
   |                              the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
50 |     pub fn hinatazaka_config(&self) -> Result<Config<'_, HClient>> {
   |                                                      +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:55:28
   |
55 |     pub fn nogizaka_config(&self) -> Result<Config<NClient>> {
   |                            ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                            |
   |                            the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
55 |     pub fn nogizaka_config(&self) -> Result<Config<'_, NClient>> {
   |                                                    +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:60:30
   |
60 |     pub fn asukasaito_config(&self) -> Result<Config<AClient>> {
   |                              ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                              |
   |                              the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
60 |     pub fn asukasaito_config(&self) -> Result<Config<'_, AClient>> {
   |                                                      +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:65:32
   |
65 |     pub fn maishiraishi_config(&self) -> Result<Config<MClient>> {
   |                                ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                                |
   |                                the lifetime is elided here
   |                                the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
65 |     pub fn maishiraishi_config(&self) -> Result<Config<'_, MClient>> {
   |                                                        +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:70:25
   |
70 |     pub fn yodel_config(&self) -> Result<Config<YClient>> {
   |                         ^^^^^            ^^^^^^^^^^^^^^^ the same lifetime is hidden here
   |                         |
   |                         the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
70 |     pub fn yodel_config(&self) -> Result<Config<'_, YClient>> {
   |                                                 +++

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src\bin\colmsg\app.rs:75:44
   |
75 |     fn config<S: AsRef<str>, C: SHNClient>(&self, refresh_token_str: S, client: C) -> Result<Config<C>> {
   |                                            ^^^^^ the lifetime is elided here                 ^^^^^^^^^ the same lifetime is hidden here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
   |
75 |     fn config<S: AsRef<str>, C: SHNClient>(&self, refresh_token_str: S, client: C) -> Result<Config<'_, C>> {
   |                                                                                                     +++

環境

  • OS: Windows 11
  • Rustバージョン: rustc 1.92.0 (ded5c06cf 2025-12-08)
  • colmsgバージョン: d50f3d2

補足

生成された colmsg.exe は問題なく動作します。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions