]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: minor changes (typo and minor refactor)
authorMarc Poulhiès <dkm@kataplop.net>
Fri, 13 Oct 2023 22:02:47 +0000 (00:02 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:38 +0000 (19:04 +0100)
Fix a typo and merge 2 if clauses using the same condition.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): Merge 2 if clauses.
* backend/rust-compile-extern.h: Fix typo in comment.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-extern.h

index 6d88b398bd36755d6b6d52911a091cd10806e6a5..929f3c0f5e4108a3cd86ce2862ff263fa4a405d2 100644 (file)
@@ -1635,17 +1635,13 @@ CompileExpr::visit (HIR::CallExpr &expr)
     return;
 
   bool is_variadic = false;
-  if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
-    {
-      const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
-      is_variadic = fn->is_variadic ();
-    }
-
   size_t required_num_args = expr.get_arguments ().size ();
+
   if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
     {
       const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
       required_num_args = fn->num_params ();
+      is_variadic = fn->is_variadic ();
     }
   else if (tyty->get_kind () == TyTy::TypeKind::FNPTR)
     {
index 127e9b099cce9f78e103b978d6c02a4832bbc65e..778553e5b37311d766e6cce1357eb9c0cdefba38 100644 (file)
@@ -115,10 +115,8 @@ public:
       }
 
     if (fntype->has_substitutions_defined ())
-      {
-       // override the Hir Lookups for the substituions in this context
-       fntype->override_context ();
-      }
+      // override the HIR lookups for the substitutions in this context
+      fntype->override_context ();
 
     if (fntype->get_abi () == ABI::INTRINSIC)
       {