From dca653d02fdfa05df988f34a450e8a217596960a Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Fri, 1 Nov 2024 02:18:29 -0400 Subject: [PATCH] Remove extra string constructors that aren't necessary anymore. --- cpp/src/Slice/Parser.cpp | 4 ++-- cpp/src/slice2cpp/CPlusPlusUtil.cpp | 4 ++-- cpp/src/slice2cs/Gen.cpp | 4 ++-- cpp/src/slice2java/Gen.cpp | 4 ++-- cpp/src/slice2java/JavaUtil.cpp | 8 ++++---- cpp/src/slice2swift/Gen.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 0689602863f..79c5142fa46 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -240,7 +240,7 @@ Slice::DefinitionContext::getMetadataArgs(string_view directive) const { if (p->directive() == directive) { - return string{p->arguments()}; + return p->arguments(); } } return nullopt; @@ -974,7 +974,7 @@ Slice::Contained::getMetadataArgs(string_view directive) const { if (p->directive() == directive) { - return string{p->arguments()}; + return p->arguments(); } } return nullopt; diff --git a/cpp/src/slice2cpp/CPlusPlusUtil.cpp b/cpp/src/slice2cpp/CPlusPlusUtil.cpp index b0cf8fc39e7..9271c5a9fcc 100644 --- a/cpp/src/slice2cpp/CPlusPlusUtil.cpp +++ b/cpp/src/slice2cpp/CPlusPlusUtil.cpp @@ -956,13 +956,13 @@ Slice::findMetadata(const MetadataList& metadata, TypeContext typeCtx) { if (directive == "cpp:view-type") { - return string{meta->arguments()}; + return meta->arguments(); } } if (directive == "cpp:type") { - return string{meta->arguments()}; + return meta->arguments(); } if ((typeCtx & (TypeContext::MarshalParam | TypeContext::UnmarshalParamZeroCopy)) != TypeContext::None) diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 5979c435126..7155d0f0c8c 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1680,7 +1680,7 @@ Slice::Gen::TypesVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) { if (metadata->directive() == "cs:implements") { - baseNames.push_back(string{metadata->arguments()}); + baseNames.push_back(metadata->arguments()); } } @@ -1952,7 +1952,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) { if (metadata->directive() == "cs:implements") { - baseNames.push_back(string{metadata->arguments()}); + baseNames.push_back(metadata->arguments()); } } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 19e5436405b..8e71ad5897f 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2318,7 +2318,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { if (metadata->directive() == "java:implements") { - implements.push_back(string{metadata->arguments()}); + implements.push_back(metadata->arguments()); } } @@ -2933,7 +2933,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) { if (metadata->directive() == "java:implements") { - implements.push_back(string{metadata->arguments()}); + implements.push_back(metadata->arguments()); } } diff --git a/cpp/src/slice2java/JavaUtil.cpp b/cpp/src/slice2java/JavaUtil.cpp index efb40928197..ab994fa6449 100644 --- a/cpp/src/slice2java/JavaUtil.cpp +++ b/cpp/src/slice2java/JavaUtil.cpp @@ -2277,16 +2277,16 @@ Slice::JavaGenerator::getTypeMetadata(const MetadataList& metadata, string& inst { if (m->directive() == "java:type") { - string_view arguments = m->arguments(); + string arguments = m->arguments(); string::size_type pos = arguments.find(':'); if (pos != string::npos) { - instanceType = string{arguments.substr(0, pos)}; - formalType = string{arguments.substr(pos + 1)}; + instanceType = arguments.substr(0, pos); + formalType = arguments.substr(pos + 1); } else { - instanceType = string{arguments}; + instanceType = arguments; formalType.clear(); } return true; diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index bc4e13aceef..a09c44cf889 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -1462,7 +1462,7 @@ Gen::ObjectVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) { if (metadata->directive() == "swift:inherits") { - baseNames.push_back(string{metadata->arguments()}); + baseNames.push_back(metadata->arguments()); } }