dbus: transition to find_if

[dbus/dbusconfiguration.cpp:58]: (style) Consider using std::find_if algorithm
instead of a raw loop.

Change-Id: I6fdabecc027addfc6f843a4b5f4621a61db39c2d
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 45f51b6..499dca1 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -14,6 +14,7 @@
 // limitations under the License.
 */
 
+#include <algorithm>
 #include <chrono>
 #include <conf.hpp>
 #include <dbus/util.hpp>
@@ -52,14 +53,16 @@
                 const std::string& search,
                 std::pair<std::string, std::string>& sensor)
 {
-    for (const auto& s : sensors)
+    auto found =
+        std::find_if(sensors.begin(), sensors.end(), [&search](const auto& s) {
+            return (s.first.find(search) != std::string::npos);
+        });
+    if (found != sensors.end())
     {
-        if (s.first.find(search) != std::string::npos)
-        {
-            sensor = s;
-            return true;
-        }
+        sensor = *found;
+        return true;
     }
+
     return false;
 }