From: Enes Cevik <[email protected]>

gcc/rust/ChangeLog:

        * backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl):
        Remove reduntant as_string calls.

Signed-off-by: Enes Cevik <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/4b4e59000f030ab74c30966ca3ea73ee7e7f16c9

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4556

 gcc/rust/backend/rust-compile-base.cc | 29 +++++++++++----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-base.cc 
b/gcc/rust/backend/rust-compile-base.cc
index 340e26178..f566cc07b 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -78,24 +78,19 @@ HIRCompileBase::setup_fndecl (tree fndecl, bool 
is_main_entry_point,
   // is it inline?
   for (const auto &attr : attrs)
     {
-      bool is_inline
-       = attr.get_path ().as_string () == Values::Attributes::INLINE;
-      bool is_must_use
-       = attr.get_path ().as_string () == Values::Attributes::MUST_USE;
-      bool is_cold = attr.get_path ().as_string () == Values::Attributes::COLD;
-      bool is_link_section
-       = attr.get_path ().as_string () == Values::Attributes::LINK_SECTION;
-      bool no_mangle
-       = attr.get_path ().as_string () == Values::Attributes::NO_MANGLE;
-      bool is_deprecated
-       = attr.get_path ().as_string () == Values::Attributes::DEPRECATED;
-      bool is_proc_macro
-       = attr.get_path ().as_string () == Values::Attributes::PROC_MACRO;
+      std::string attr_str = attr.get_path ().as_string ();
+
+      bool is_inline = attr_str == Values::Attributes::INLINE;
+      bool is_must_use = attr_str == Values::Attributes::MUST_USE;
+      bool is_cold = attr_str == Values::Attributes::COLD;
+      bool is_link_section = attr_str == Values::Attributes::LINK_SECTION;
+      bool no_mangle = attr_str == Values::Attributes::NO_MANGLE;
+      bool is_deprecated = attr_str == Values::Attributes::DEPRECATED;
+      bool is_proc_macro = attr_str == Values::Attributes::PROC_MACRO;
       bool is_proc_macro_attribute
-       = attr.get_path ().as_string ()
-         == Values::Attributes::PROC_MACRO_ATTRIBUTE;
-      bool is_proc_macro_derive = attr.get_path ().as_string ()
-                                 == Values::Attributes::PROC_MACRO_DERIVE;
+       = attr_str == Values::Attributes::PROC_MACRO_ATTRIBUTE;
+      bool is_proc_macro_derive
+       = attr_str == Values::Attributes::PROC_MACRO_DERIVE;
 
       if (is_inline)
        {

base-commit: 753a3a27edb780492d190c595264109d19dff89c
-- 
2.54.0

Reply via email to