From 4857a58fdd793c0ccf887d17ad8a625218077a82 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 30 Sep 2022 15:04:01 +0200 Subject: [PATCH] GitLab: Limit the usage of std::make_pair Make the code less verbose. Change-Id: If938923022f8bcdb2559328e03035b8b38145f3e Reviewed-by: Christian Stenger Reviewed-by: --- src/plugins/gitlab/resultparser.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/gitlab/resultparser.cpp b/src/plugins/gitlab/resultparser.cpp index d583b8cc6c5..c8ec89d5dba 100644 --- a/src/plugins/gitlab/resultparser.cpp +++ b/src/plugins/gitlab/resultparser.cpp @@ -60,7 +60,7 @@ static std::pair splitHeaderAndBody(const QByteArray &in } else { json = input; } - return std::make_pair(header, json); + return {header, json}; } static std::pair preHandleSingle(const QByteArray &json) @@ -87,7 +87,7 @@ static std::pair preHandleSingle(const QByteArray &json) } } - return std::make_pair(result, object); + return {result, object}; } static std::pair preHandleHeaderAndBody(const QByteArray &header, @@ -96,33 +96,33 @@ static std::pair preHandleHeaderAndBody(const QByteArray & Error result; if (header.isEmpty()) { result.message = "Missing Expected Header"; - return std::make_pair(result, QJsonDocument()); + return {result, {}}; } QJsonParseError error; const QJsonDocument doc = QJsonDocument::fromJson(json, &error); if (error.error != QJsonParseError::NoError) { result.message = error.errorString(); - return std::make_pair(result, doc); + return {result, doc}; } if (doc.isObject()) { const QJsonObject obj = doc.object(); if (obj.contains("message")) { result = parseErrorMessage(obj.value("message").toString()); - return std::make_pair(result, doc); + return {result, doc}; } else if (obj.contains("error")) { if (obj.value("error").toString() == "insufficient_scope") result.code = 1; result.message = obj.value("error_description").toString(); - return std::make_pair(result, doc); + return {result, doc}; } } if (!doc.isArray()) result.message = "Not an Array"; - return std::make_pair(result, doc); + return {result, doc}; } static User userFromJson(const QJsonObject &jsonObj)