Browse Source

Fixes two `elided_named_lifetimes` warnings (#1680)

When I build Solang, I see these two warnings:
```
warning: elided lifetime has a name
   --> src/emit/mod.rs:375:18
    |
369 |     pub fn binary<'a>(
    |                   -- lifetime `'a` declared here
...
375 |     ) -> binary::Binary {
    |                  ^^^^^^ this elided lifetime gets resolved as `'a`
    |
    = note: `#[warn(elided_named_lifetimes)]` on by default

warning: elided lifetime has a name
   --> src/sema/builtin_structs.rs:243:59
    |
243 |     pub fn definition<'a>(&'a self, ns: &'a Namespace) -> &StructDecl {
    |                       -- lifetime `'a` declared here      ^ this elided lifetime gets resolved as `'a`
```
This PR addresses both of the warnings.

Signed-off-by: Samuel Moelius <samuel.moelius@trailofbits.com>
Samuel Moelius 9 months ago
parent
commit
e5dc149b7b
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/emit/mod.rs
  2. 1 1
      src/sema/builtin_structs.rs

+ 1 - 1
src/emit/mod.rs

@@ -372,7 +372,7 @@ impl ast::Contract {
         context: &'a inkwell::context::Context,
         opt: &'a Options,
         contract_no: usize,
-    ) -> binary::Binary {
+    ) -> binary::Binary<'a> {
         binary::Binary::build(context, self, ns, opt, contract_no)
     }
 

+ 1 - 1
src/sema/builtin_structs.rs

@@ -240,7 +240,7 @@ pub static BUILTIN_STRUCTS: Lazy<[BuiltinStructDeclaration; 3]> = Lazy::new(|| {
 });
 
 impl StructType {
-    pub fn definition<'a>(&'a self, ns: &'a Namespace) -> &StructDecl {
+    pub fn definition<'a>(&'a self, ns: &'a Namespace) -> &'a StructDecl {
         match self {
             StructType::UserDefined(struct_no) => &ns.structs[*struct_no],
             StructType::AccountInfo => &BUILTIN_STRUCTS[0].struct_decl,