Skip to content

Commit 6e2acda

Browse files
authored
Merge pull request #2225 from joto/cleanup
Various code cleanups
2 parents e63f84b + 4361dbe commit 6e2acda

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

.clang-tidy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,8 @@ CheckOptions:
8787
value: 100
8888
- key: readability-function-cognitive-complexity.IgnoreMacros
8989
value: true
90+
- key: cppcoreguidelines-rvalue-reference-param-not-moved.AllowPartialMove
91+
value: true
92+
- key: bugprone-empty-catch.IgnoreCatchWithKeywords
93+
value: "@todo;@fixme;exception ignored on purpose"
9094
...

src/expire-tiles.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ void expire_tiles::from_geometry(geom::multipolygon_t const &geom,
135135
}
136136
}
137137

138+
// False positive: Apparently clang-tidy can not see through the visit()
139+
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
138140
void expire_tiles::from_geometry(geom::geometry_t const &geom,
139141
expire_config_t const &expire_config)
140142
{
@@ -174,7 +176,7 @@ void expire_tiles::from_line_segment(geom::point_t const &a,
174176
}
175177

176178
double const y_len = tilec_b.y() - tilec_a.y();
177-
double const hyp_len = sqrt(pow(x_len, 2) + pow(y_len, 2)); /* Pythagoras */
179+
double const hyp_len = std::sqrt(x_len * x_len + y_len * y_len); /* Pythagoras */
178180
double const x_step = x_len / hyp_len;
179181
double const y_step = y_len / hyp_len;
180182

src/gen/osm2pgsql-gen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ tile_extent get_extent_from_db(pg_conn_t const &db_connection,
159159
auto const geom_column = params.get_string("geom_column", "geom");
160160
auto const raster_column = params.get_string("raster_column", "");
161161

162-
bool const is_raster = raster_column != "";
162+
bool const is_raster = !raster_column.empty();
163163

164164
return get_extent_from_db(db_connection, schema, table,
165165
is_raster ? raster_column : geom_column,

src/geom-functions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ class split_visitor
437437
void operator()(T) const
438438
{}
439439

440+
// false positive https://github.com/llvm/llvm-project/issues/74738
441+
// NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
440442
void operator()(geom::collection_t &&geom) const
441443
{
442444
for (auto &&sgeom : geom) {
@@ -445,6 +447,8 @@ class split_visitor
445447
}
446448

447449
template <typename T>
450+
// false positive https://github.com/llvm/llvm-project/issues/74738
451+
// NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
448452
void operator()(geom::multigeometry_t<T> &&geom) const
449453
{
450454
for (auto &&sgeom : geom) {

src/node-persistent-cache.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ node_persistent_cache::~node_persistent_cache() noexcept
5656
try {
5757
log_debug("Removing persistent node cache at '{}'.", m_file_name);
5858
} catch (...) {
59+
// exception ignored on purpose
5960
}
6061
unlink(m_file_name.c_str());
6162
}

src/thread-pool.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class thread_pool_t
9595
* of the task can be queried.
9696
*/
9797
template <typename TFunction>
98+
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) false positive
9899
std::future<std::chrono::microseconds> submit(TFunction &&func)
99100
{
100101
std::packaged_task<std::chrono::microseconds()> task{

0 commit comments

Comments
 (0)