Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 041f8f50 authored by Maciej Żenczykowski's avatar Maciej Żenczykowski
Browse files

add NOLINTNEXTLINE(google-explicit-constructor)



Test: builds without warnings
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Change-Id: Iac7c63816dd7bf2536c0d465ef1e845330be505b
parent d66e442c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ class _NODISCARD_ expected {
    !(!std::is_convertible_v<const U&, T> ||
     !std::is_convertible_v<const G&, E>) /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(const expected<U, G>& rhs) {
    if (rhs.has_value()) var_ = rhs.value();
    else var_ = unexpected(rhs.error());
@@ -149,6 +150,7 @@ class _NODISCARD_ expected {
    !(!std::is_convertible_v<const U&, T> ||
     !std::is_convertible_v<const G&, E>) /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(expected<U, G>&& rhs) {
    if (rhs.has_value()) var_ = std::move(rhs.value());
    else var_ = unexpected(std::move(rhs.error()));
@@ -180,6 +182,7 @@ class _NODISCARD_ expected {
                !std::is_same_v<unexpected<E>, std::remove_cv_t<std::remove_reference_t<U>>> &&
                std::is_convertible_v<U&&, T> /* non-explicit */
                )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(U&& v) : var_(std::in_place_index<0>, std::forward<U>(v)) {}

  template <class U = T _ENABLE_IF(
@@ -195,6 +198,7 @@ class _NODISCARD_ expected {
    std::is_constructible_v<E, const G&> &&
    std::is_convertible_v<const G&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(const unexpected<G>& e)
  : var_(std::in_place_index<1>, e.value()) {}

@@ -209,6 +213,7 @@ class _NODISCARD_ expected {
    std::is_constructible_v<E, G&&> &&
    std::is_convertible_v<G&&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(unexpected<G>&& e)
  : var_(std::in_place_index<1>, std::move(e.value())) {}

@@ -457,6 +462,7 @@ class _NODISCARD_ expected<void, E> {
    std::is_void_v<U> &&
    std::is_convertible_v<const G&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(const expected<U, G>& rhs) {
    if (!rhs.has_value()) var_ = unexpected(rhs.error());
  }
@@ -473,6 +479,7 @@ class _NODISCARD_ expected<void, E> {
    std::is_void_v<U> &&
    std::is_convertible_v<const G&&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(expected<U, G>&& rhs) {
    if (!rhs.has_value()) var_ = unexpected(std::move(rhs.error()));
  }
@@ -489,6 +496,7 @@ class _NODISCARD_ expected<void, E> {
    std::is_constructible_v<E, const G&> &&
    std::is_convertible_v<const G&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(const unexpected<G>& e)
  : var_(std::in_place_index<1>, e.value()) {}

@@ -503,6 +511,7 @@ class _NODISCARD_ expected<void, E> {
    std::is_constructible_v<E, G&&> &&
    std::is_convertible_v<G&&, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr expected(unexpected<G>&& e)
  : var_(std::in_place_index<1>, std::move(e.value())) {}

@@ -640,6 +649,7 @@ class unexpected {
                std::is_constructible_v<E, Err> &&
                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<E>>, std::in_place_t> &&
                !std::is_same_v<std::remove_cv_t<std::remove_reference_t<E>>, unexpected>)>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr unexpected(Err&& e) : val_(std::forward<Err>(e)) {}

  template<class U, class... Args _ENABLE_IF(
@@ -660,6 +670,7 @@ class unexpected {
    !std::is_convertible_v<const unexpected<Err>, E> &&
    std::is_convertible_v<Err, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr unexpected(const unexpected<Err>& rhs)
  : val_(rhs.value()) {}

@@ -690,6 +701,7 @@ class unexpected {
    !std::is_convertible_v<const unexpected<Err>, E> &&
    std::is_convertible_v<Err, E> /* non-explicit */
  )>
  // NOLINTNEXTLINE(google-explicit-constructor)
  constexpr unexpected(unexpected<Err>&& rhs)
  : val_(std::move(rhs.value())) {}

+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ struct ResultError {
  ResultError(T&& message, int code) : message_(std::forward<T>(message)), code_(code) {}

  template <typename T>
  // NOLINTNEXTLINE(google-explicit-constructor)
  operator android::base::expected<T, ResultError>() {
    return android::base::unexpected(ResultError(message_, code_));
  }
@@ -118,9 +119,11 @@ inline std::ostream& operator<<(std::ostream& os, const ResultError& t) {
class Error {
 public:
  Error() : errno_(0), append_errno_(false) {}
  // NOLINTNEXTLINE(google-explicit-constructor)
  Error(int errno_to_append) : errno_(errno_to_append), append_errno_(true) {}

  template <typename T>
  // NOLINTNEXTLINE(google-explicit-constructor)
  operator android::base::expected<T, ResultError>() {
    return android::base::unexpected(ResultError(str(), errno_));
  }