mirror of https://github.com/mamba-org/mamba.git
maint: Address compiler warnings (#3605)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
This commit is contained in:
parent
ccbf795281
commit
6654e15633
|
@ -277,11 +277,11 @@ namespace mamba::util
|
|||
template <typename T, std::size_t N>
|
||||
constexpr auto find(const std::array<T, N>& arr, const T& val) -> std::size_t
|
||||
{
|
||||
auto pos = std::size_t(N);
|
||||
std::size_t pos = N;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
const bool found = arr[i] == val;
|
||||
pos = static_cast<int>(found) * i + (1 - static_cast<int>(found)) * pos;
|
||||
pos = found ? i : pos;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
|
|
@ -261,11 +261,11 @@ namespace mamba
|
|||
{
|
||||
j = nlohmann::json::parse(out);
|
||||
}
|
||||
catch (const std::exception& ec)
|
||||
catch (const std::exception& exc)
|
||||
{
|
||||
const auto message = fmt::format(
|
||||
"failed to parse python command output:\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}",
|
||||
ec.what(),
|
||||
exc.what(),
|
||||
fmt::join(args, " "),
|
||||
fmt::join(env, " "),
|
||||
out,
|
||||
|
|
|
@ -1395,7 +1395,7 @@ namespace mamba
|
|||
{
|
||||
if (!m_is_spinner)
|
||||
{
|
||||
auto seed = static_cast<std::size_t>(
|
||||
auto seed = static_cast<typename std::default_random_engine::result_type>(
|
||||
std::chrono::system_clock::now().time_since_epoch().count()
|
||||
);
|
||||
std::default_random_engine generator(seed);
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
//
|
||||
// The full license is in the file LICENSE, distributed with this software.
|
||||
|
||||
// There are several `CHECK_THROWS_AS` expressions in this file.
|
||||
// Sometimes they call a method marked as `[[nodiscard]]`.
|
||||
// This causes compiler warnnings.
|
||||
// This doctest flag is designed specifically to prevent this warning from happening.
|
||||
// https://github.com/doctest/doctest/blob/master/doc/markdown/configuration.md#doctest_config_void_cast_expressions
|
||||
#define DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
@ -249,7 +256,7 @@ TEST_SUITE("validation::v0_6::RootImpl")
|
|||
out_file.close();
|
||||
|
||||
// "2.sv1.root.json" is not compatible spec version (spec version N)
|
||||
CHECK_THROWS_AS(v0_6::RootImpl root(p), role_file_error);
|
||||
CHECK_THROWS_AS(v0_6::RootImpl{ p }, role_file_error);
|
||||
}
|
||||
|
||||
TEST_CASE_FIXTURE(RootImplT_v0_6, "update_from_path")
|
||||
|
|
|
@ -211,7 +211,7 @@ read_binary_from_stdin_and_write_to_file(fs::u8path& filename)
|
|||
{
|
||||
throw std::runtime_error("Reading from stdin failed.");
|
||||
}
|
||||
out_stream.write(buffer.data(), len);
|
||||
out_stream.write(buffer.data(), static_cast<std::streamsize>(len));
|
||||
}
|
||||
out_stream.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue