[gcc r14-7514] gccrs: minor refactor to reuse a variable instead of recreating it later

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:40:30 GMT 2024


https://gcc.gnu.org/g:8e8c56392edb2cdf7d61672dda609bbb6b5941e2

commit r14-7514-g8e8c56392edb2cdf7d61672dda609bbb6b5941e2
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Mon Apr 17 21:01:25 2023 +0100

    gccrs: minor refactor to reuse a variable instead of recreating it later
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-expr.cc: refactor
    
    Signed-off-by: Philip Herron <herron.philip@googlemail.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-expr.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index ce215e35322..4e4fdbaec1e 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -1595,8 +1595,7 @@ TypeCheckExpr::resolve_operator_overload (
     return false;
 
   auto segment = HIR::PathIdentSegment (associated_item_name);
-  auto candidates
-    = MethodResolver::Probe (lhs, HIR::PathIdentSegment (associated_item_name));
+  auto candidates = MethodResolver::Probe (lhs, segment);
 
   bool have_implementation_for_lang_item = candidates.size () > 0;
   if (!have_implementation_for_lang_item)


More information about the Gcc-cvs mailing list