chore: silence clang-tidy warnings (#7586)

This commit is contained in:
Yat Ho
2025-05-06 09:00:48 +08:00
committed by GitHub
parent 1aebc3c0cb
commit c016e97dcd
3 changed files with 9 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ Cache::Key Cache::make_key(tr_torrent const& tor, tr_block_info::Location const
return std::make_pair(tor.id(), loc.block); return std::make_pair(tor.id(), loc.block);
} }
Cache::CIter Cache::find_span_end(CIter span_begin, CIter end) noexcept Cache::CIter Cache::find_span_end(CIter const& span_begin, CIter const& end) noexcept
{ {
static constexpr auto NotAdjacent = [](CacheBlock const& block1, CacheBlock const& block2) static constexpr auto NotAdjacent = [](CacheBlock const& block1, CacheBlock const& block2)
{ {
@@ -39,7 +39,7 @@ Cache::CIter Cache::find_span_end(CIter span_begin, CIter end) noexcept
return span_end == end ? end : std::next(span_end); return span_end == end ? end : std::next(span_end);
} }
std::pair<Cache::CIter, Cache::CIter> Cache::find_biggest_span(CIter const begin, CIter const end) noexcept std::pair<Cache::CIter, Cache::CIter> Cache::find_biggest_span(CIter const& begin, CIter const& end) noexcept
{ {
auto biggest_begin = begin; auto biggest_begin = begin;
auto biggest_end = begin; auto biggest_end = begin;
@@ -62,7 +62,7 @@ std::pair<Cache::CIter, Cache::CIter> Cache::find_biggest_span(CIter const begin
return { biggest_begin, biggest_end }; return { biggest_begin, biggest_end };
} }
int Cache::write_contiguous(CIter const begin, CIter const end) const int Cache::write_contiguous(CIter const& begin, CIter const& end) const
{ {
// The most common case without an extra data copy. // The most common case without an extra data copy.
auto const* out = std::data(*begin->buf); auto const* out = std::data(*begin->buf);
@@ -185,7 +185,7 @@ int Cache::read_block(tr_torrent const& tor, tr_block_info::Location const& loc,
// --- // ---
int Cache::flush_span(CIter const begin, CIter const end) int Cache::flush_span(CIter const& begin, CIter const& end)
{ {
for (auto span_begin = begin; span_begin < end;) for (auto span_begin = begin; span_begin < end;)
{ {

View File

@@ -56,15 +56,15 @@ private:
[[nodiscard]] static Key make_key(tr_torrent const& tor, tr_block_info::Location loc) noexcept; [[nodiscard]] static Key make_key(tr_torrent const& tor, tr_block_info::Location loc) noexcept;
[[nodiscard]] static std::pair<CIter, CIter> find_biggest_span(CIter begin, CIter end) noexcept; [[nodiscard]] static std::pair<CIter, CIter> find_biggest_span(CIter const& begin, CIter const& end) noexcept;
[[nodiscard]] static CIter find_span_end(CIter span_begin, CIter end) noexcept; [[nodiscard]] static CIter find_span_end(CIter const& span_begin, CIter const& end) noexcept;
// @return any error code from tr_ioWrite() // @return any error code from tr_ioWrite()
[[nodiscard]] int write_contiguous(CIter begin, CIter end) const; [[nodiscard]] int write_contiguous(CIter const& begin, CIter const& end) const;
// @return any error code from writeContiguous() // @return any error code from writeContiguous()
[[nodiscard]] int flush_span(CIter begin, CIter end); [[nodiscard]] int flush_span(CIter const& begin, CIter const& end);
// @return any error code from writeContiguous() // @return any error code from writeContiguous()
[[nodiscard]] int flush_biggest(); [[nodiscard]] int flush_biggest();

View File

@@ -390,7 +390,7 @@ private:
} }
} }
TR_CONSTEXPR20 void resort_piece(CandidateVec::iterator const pos_old) TR_CONSTEXPR20 void resort_piece(CandidateVec::iterator const& pos_old)
{ {
if (candidates_dirty_) if (candidates_dirty_)
{ {