Skip to content

Commit

Permalink
maint: Update clang-format to v19 (#3600)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru authored Nov 18, 2024
1 parent 6654e15 commit ad9b2d6
Show file tree
Hide file tree
Showing 77 changed files with 421 additions and 407 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
- id: blacken-docs
additional_dependencies: [black==24.10.0]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.2
rev: v19.1.3
hooks:
- id: clang-format
args: [--style=file]
Expand Down
4 changes: 2 additions & 2 deletions libmamba/ext/solv-cpp/include/solv-cpp/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ namespace solv
*/
[[nodiscard]] auto problem_rules(ProblemId id) const -> ObjQueue;
[[nodiscard]] auto get_rule_info(const ObjPool& pool, RuleId id) const -> ObjRuleInfo;
[[nodiscard]] auto
rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const -> std::string;
[[nodiscard]] auto rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const
-> std::string;

private:

Expand Down
8 changes: 4 additions & 4 deletions libmamba/ext/solv-cpp/include/solv-cpp/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ namespace solv
*
* Negative solvable ids are use to mean that the solvable must be removed.
*/
[[nodiscard]] static auto
from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction;
[[nodiscard]] static auto from_solvables(const ObjPool& pool, const ObjQueue& solvables)
-> ObjTransaction;

/**
* Create a transaction from the result of a solver run.
*
* The solver must be solved.
*/
[[nodiscard]] static auto
from_solver(const ObjPool& pool, const ObjSolver& solver) -> ObjTransaction;
[[nodiscard]] static auto from_solver(const ObjPool& pool, const ObjSolver& solver)
-> ObjTransaction;

ObjTransaction(const ObjPool& pool);
ObjTransaction(ObjTransaction&&) noexcept = default;
Expand Down
8 changes: 4 additions & 4 deletions libmamba/ext/solv-cpp/src/pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ namespace solv
return (id == 0) ? std::nullopt : std::optional(DependencyId{ id });
}

auto
ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id) -> DependencyId
auto ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id)
-> DependencyId
{
// Note: libsolv cannot report failure to allocate
const ::Id id = ::pool_rel2id(
Expand Down Expand Up @@ -181,8 +181,8 @@ namespace solv
return solvables;
}

auto
ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const -> ObjQueue
auto ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const
-> ObjQueue
{
ObjQueue solvables = {};
::pool_whatmatchesdep(const_cast<::Pool*>(raw()), key, dep, solvables.raw(), marker);
Expand Down
4 changes: 2 additions & 2 deletions libmamba/ext/solv-cpp/src/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ namespace solv
};
}

auto
ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const -> std::string
auto ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const
-> std::string
{
// pool is captured inside solver so we take it as a parameter to be explicit.
return ::solver_ruleinfo2str(
Expand Down
8 changes: 4 additions & 4 deletions libmamba/ext/solv-cpp/src/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace solv
return *this;
}

auto
ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction
auto ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables)
-> ObjTransaction
{
return ObjTransaction{ ::transaction_create_decisionq(
const_cast<::Pool*>(pool.raw()),
Expand Down Expand Up @@ -103,8 +103,8 @@ namespace solv
return ::transaction_type(const_cast<::Transaction*>(raw()), step, mode);
}

auto
ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const -> std::optional<SolvableId>
auto ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const
-> std::optional<SolvableId>
{
assert_same_pool(pool, *this);
if (const auto solvable = pool.get_solvable(step); solvable && solvable->installed())
Expand Down
4 changes: 2 additions & 2 deletions libmamba/ext/solv-cpp/tests/src/pool_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace solv::test
return attrs(a) >= attrs(b);
}

auto
add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg) -> solv::SolvableId
auto add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg)
-> solv::SolvableId
{
auto [solv_id, solv] = repo.add_solvable();
solv.set_name(pkg.name);
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/core/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ namespace mamba

using Database = solver::libsolv::Database;

[[nodiscard]] static auto
find(Database& db, const std::vector<std::string>& queries) -> QueryResult;
[[nodiscard]] static auto find(Database& db, const std::vector<std::string>& queries)
-> QueryResult;

[[nodiscard]] static auto whoneeds(Database& db, std::string query, bool tree) -> QueryResult;

Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/download/mirror_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace mamba::download
};

template <class MirrorType, class... Args>
auto
mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args) -> MirrorType&
auto mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args)
-> MirrorType&
{
static_assert(std::is_base_of_v<Mirror, MirrorType>);

Expand Down
24 changes: 10 additions & 14 deletions libmamba/include/mamba/solver/libsolv/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ namespace mamba::solver::libsolv
PipAsPythonDependency add = PipAsPythonDependency::No
) -> RepoInfo;

auto native_serialize_repo(
const RepoInfo& repo,
const fs::u8path& path,
const RepodataOrigin& metadata
) -> expected_t<RepoInfo>;
auto
native_serialize_repo(const RepoInfo& repo, const fs::u8path& path, const RepodataOrigin& metadata)
-> expected_t<RepoInfo>;

[[nodiscard]] auto installed_repo() const -> std::optional<RepoInfo>;

Expand Down Expand Up @@ -162,11 +160,11 @@ namespace mamba::solver::libsolv

[[nodiscard]] auto packages_in_repo(RepoInfo repo) const -> std::vector<PackageId>;

[[nodiscard]] auto
packages_matching_ids(const specs::MatchSpec& ms) -> std::vector<PackageId>;
[[nodiscard]] auto packages_matching_ids(const specs::MatchSpec& ms)
-> std::vector<PackageId>;

[[nodiscard]] auto
packages_depending_on_ids(const specs::MatchSpec& ms) -> std::vector<PackageId>;
[[nodiscard]] auto packages_depending_on_ids(const specs::MatchSpec& ms)
-> std::vector<PackageId>;
};

/********************
Expand All @@ -191,11 +189,9 @@ namespace mamba::solver::libsolv
}

template <typename Range>
auto Database::add_repo_from_packages(
const Range& packages,
std::string_view name,
PipAsPythonDependency add
) -> RepoInfo
auto
Database::add_repo_from_packages(const Range& packages, std::string_view name, PipAsPythonDependency add)
-> RepoInfo
{
return add_repo_from_packages(packages.begin(), packages.end(), name, add);
}
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/specs/build_number_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ namespace mamba::specs
BuildNumberPredicate(BuildNumber ver, BinaryOperator op);

friend auto equal(free_interval, free_interval) -> bool;
friend auto
operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) -> bool;
friend auto operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs)
-> bool;
friend struct ::fmt::formatter<BuildNumberPredicate>;
};

Expand Down
8 changes: 4 additions & 4 deletions libmamba/include/mamba/specs/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ namespace mamba::specs
/**
* Remove the last element of the '/'-separated name.
*/
[[nodiscard]] auto
weaken_key(std::string_view key) const -> std::optional<std::string_view>;
[[nodiscard]] auto weaken_key(std::string_view key) const
-> std::optional<std::string_view>;
};

template <typename Key, typename Value>
Expand Down Expand Up @@ -95,8 +95,8 @@ namespace mamba::specs

[[nodiscard]] auto mirror_urls() const -> const std::vector<CondaURL>&;
[[nodiscard]] auto platform_mirror_urls() const -> std::vector<CondaURL>;
[[nodiscard]] auto
platform_mirror_urls(const std::string_view platform) const -> std::vector<CondaURL>;
[[nodiscard]] auto platform_mirror_urls(const std::string_view platform) const
-> std::vector<CondaURL>;

[[nodiscard]] auto url() const -> const CondaURL&;
auto clear_url() -> const CondaURL;
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/specs/glob_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ struct fmt::formatter<mamba::specs::GlobSpec>
{
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());

auto
format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const -> decltype(ctx.out());
auto format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const
-> decltype(ctx.out());
};

template <>
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/specs/match_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ struct fmt::formatter<::mamba::specs::MatchSpec>
{
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());

auto
format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const -> decltype(ctx.out());
auto format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const
-> decltype(ctx.out());
};

/*********************************
Expand Down
8 changes: 4 additions & 4 deletions libmamba/include/mamba/specs/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ namespace mamba::specs
return static_cast<std::size_t>(KnownPlatform::count_);
}

[[nodiscard]] constexpr auto
known_platforms() -> std::array<KnownPlatform, known_platforms_count()>;
[[nodiscard]] constexpr auto known_platforms()
-> std::array<KnownPlatform, known_platforms_count()>;

[[nodiscard]] constexpr auto
known_platform_names() -> std::array<std::string_view, known_platforms_count()>;
[[nodiscard]] constexpr auto known_platform_names()
-> std::array<std::string_view, known_platforms_count()>;

/**
* Convert the enumeration to its conda string.
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/specs/regex_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ struct fmt::formatter<mamba::specs::RegexSpec>
{
auto parse(format_parse_context& ctx) -> decltype(ctx.begin());

auto
format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const -> decltype(ctx.out());
auto format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const
-> decltype(ctx.out());
};

template <>
Expand Down
8 changes: 4 additions & 4 deletions libmamba/include/mamba/specs/version_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace mamba::specs
[[nodiscard]] static auto make_less_equal(Version ver) -> VersionPredicate;
[[nodiscard]] static auto make_starts_with(Version ver) -> VersionPredicate;
[[nodiscard]] static auto make_not_starts_with(Version ver) -> VersionPredicate;
[[nodiscard]] static auto
make_compatible_with(Version ver, std::size_t level) -> VersionPredicate;
[[nodiscard]] static auto make_compatible_with(Version ver, std::size_t level)
-> VersionPredicate;

/** Construct an free interval. */
VersionPredicate() = default;
Expand Down Expand Up @@ -243,8 +243,8 @@ struct fmt::formatter<mamba::specs::VersionSpec>

auto parse(format_parse_context& ctx) -> decltype(ctx.begin());

auto
format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const -> decltype(ctx.out());
auto format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const
-> decltype(ctx.out());
};

template <>
Expand Down
20 changes: 10 additions & 10 deletions libmamba/include/mamba/util/encoding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ namespace mamba::util
/**
* Convert two hexadecimal characters to a byte.
*/
[[nodiscard]] auto
two_hex_to_byte(char high, char low, EncodingError& error) noexcept -> std::byte;
[[nodiscard]] auto two_hex_to_byte(char high, char low, EncodingError& error) noexcept
-> std::byte;

/**
* Convert two hexadecimal characters to a byte.
*/
[[nodiscard]] auto
two_hex_to_byte(char high, char low) noexcept -> tl::expected<std::byte, EncodingError>;
[[nodiscard]] auto two_hex_to_byte(char high, char low) noexcept
-> tl::expected<std::byte, EncodingError>;

/**
* Convert hexadecimal characters to a bytes and write it to the given output.
Expand All @@ -74,8 +74,8 @@ namespace mamba::util
* The number of hexadecimal characters must be even and out must be allocated with half the
* number of hexadecimal characters.
*/
[[nodiscard]] auto
hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept -> tl::expected<void, EncodingError>;
[[nodiscard]] auto hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept
-> tl::expected<void, EncodingError>;

/**
* Escape reserved URL reserved characters with '%' encoding.
Expand All @@ -100,13 +100,13 @@ namespace mamba::util
/**
* Convert a string to base64 encoding.
*/
[[nodiscard]] auto
encode_base64(std::string_view input) -> tl::expected<std::string, EncodingError>;
[[nodiscard]] auto encode_base64(std::string_view input)
-> tl::expected<std::string, EncodingError>;

/**
* Convert a string from base64 back to its original representation.
*/
[[nodiscard]] auto
decode_base64(std::string_view input) -> tl::expected<std::string, EncodingError>;
[[nodiscard]] auto decode_base64(std::string_view input)
-> tl::expected<std::string, EncodingError>;
}
#endif
8 changes: 4 additions & 4 deletions libmamba/include/mamba/util/environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ namespace mamba::util
* Return the full path of a program from its name if found inside the given directories.
*/
template <typename Iter>
[[nodiscard]] auto
which_in(std::string_view exe, Iter search_path_first, Iter search_path_last) -> fs::u8path;
[[nodiscard]] auto which_in(std::string_view exe, Iter search_path_first, Iter search_path_last)
-> fs::u8path;

/**
* Return the full path of a program from its name if found inside the given directories.
Expand Down Expand Up @@ -139,8 +139,8 @@ namespace mamba::util
{
[[nodiscard]] auto which_in_one(const fs::u8path& exe, const fs::u8path& dir) -> fs::u8path;

[[nodiscard]] auto
which_in_split(const fs::u8path& exe, std::string_view paths) -> fs::u8path;
[[nodiscard]] auto which_in_split(const fs::u8path& exe, std::string_view paths)
-> fs::u8path;
}

template <typename Iter>
Expand Down
12 changes: 5 additions & 7 deletions libmamba/include/mamba/util/flat_binary_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ namespace mamba::util
* The children must have been previously added to the tree and their IDs can be used
* to point to them.
*/
auto
add_branch(const branch_type& branch, idx_type left_child, idx_type right_child) -> idx_type;
auto add_branch(const branch_type& branch, idx_type left_child, idx_type right_child)
-> idx_type;
auto add_branch(branch_type&& branch, idx_type left_child, idx_type right_child) -> idx_type;

[[nodiscard]] auto node(idx_type idx) const -> const node_type&;
Expand Down Expand Up @@ -258,11 +258,9 @@ namespace mamba::util
}

template <typename B, typename L>
auto flat_binary_tree<B, L>::add_branch(
const branch_type& branch,
idx_type left_child,
idx_type right_child
) -> idx_type
auto
flat_binary_tree<B, L>::add_branch(const branch_type& branch, idx_type left_child, idx_type right_child)
-> idx_type
{
return add_branch_impl(branch, left_child, right_child);
}
Expand Down
4 changes: 2 additions & 2 deletions libmamba/include/mamba/util/flat_bool_expr_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ namespace mamba::util
void reserve(size_type size);

template <typename UnaryFunc = identity>
[[nodiscard]] auto
evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const -> bool;
[[nodiscard]] auto evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const
-> bool;

template <typename UnaryFunc>
void infix_for_each(UnaryFunc&& func) const;
Expand Down
Loading

0 comments on commit ad9b2d6

Please sign in to comment.