Useless changes

This commit is contained in:
Alexey Milovidov 2024-05-09 03:58:34 +02:00
parent 97f24f38b8
commit 224e1940ae
28 changed files with 57 additions and 57 deletions

View File

@ -130,6 +130,7 @@ Checks: [
'-readability-redundant-inline-specifier',
'-readability-redundant-member-init',
'-bugprone-crtp-constructor-accessibility',
'-bugprone-suspicious-stringview-data-usage',
'-zircon-*'
]

View File

@ -52,7 +52,7 @@ function(absl_cc_library)
)
target_include_directories(${_NAME}
PUBLIC "${ABSL_COMMON_INCLUDE_DIRS}")
SYSTEM PUBLIC "${ABSL_COMMON_INCLUDE_DIRS}")
target_compile_options(${_NAME}
PRIVATE ${ABSL_CC_LIB_COPTS})
target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES})
@ -61,7 +61,7 @@ function(absl_cc_library)
# Generating header-only library
add_library(${_NAME} INTERFACE)
target_include_directories(${_NAME}
INTERFACE "${ABSL_COMMON_INCLUDE_DIRS}")
SYSTEM INTERFACE "${ABSL_COMMON_INCLUDE_DIRS}")
target_link_libraries(${_NAME}
INTERFACE

View File

@ -323,7 +323,7 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
{
fmt::print("Symlink {} already exists but it points to {}. Will replace the old symlink to {}.\n",
main_bin_path.string(), points_to.string(), binary_self_canonical_path.string());
fs::remove(main_bin_path);
(void)fs::remove(main_bin_path);
}
}
}
@ -489,7 +489,7 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
{
fmt::print("Symlink {} already exists but it points to {}. Will replace the old symlink to {}.\n",
symlink_path.string(), points_to.string(), main_bin_path.string());
fs::remove(symlink_path);
(void)fs::remove(symlink_path);
}
}
}
@ -1006,7 +1006,7 @@ namespace
else
{
fmt::print("{} file exists but damaged, ignoring.\n", pid_file.string());
fs::remove(pid_file);
(void)fs::remove(pid_file);
}
}
else
@ -1014,7 +1014,7 @@ namespace
/// Create a directory for pid file.
/// It's created by "install" but we also support cases when ClickHouse is already installed different way.
fs::path pid_path = pid_file;
pid_path.remove_filename();
pid_path = pid_path.remove_filename();
fs::create_directories(pid_path);
/// All users are allowed to read pid file (for clickhouse status command).
fs::permissions(pid_path, fs::perms::owner_all | fs::perms::group_read | fs::perms::others_read, fs::perm_options::replace);
@ -1098,7 +1098,7 @@ namespace
else
{
fmt::print("{} file exists but damaged, ignoring.\n", pid_file.string());
fs::remove(pid_file);
(void)fs::remove(pid_file);
}
}
catch (const Exception & e)

View File

@ -37,7 +37,7 @@ std::string getIdentifierQuote(nanodbc::ConnectionHolderPtr connection_holder)
IdentifierQuotingStyle getQuotingStyle(nanodbc::ConnectionHolderPtr connection)
{
auto identifier_quote = getIdentifierQuote(connection);
if (identifier_quote.length() == 0)
if (identifier_quote.empty())
return IdentifierQuotingStyle::None;
else if (identifier_quote[0] == '`')
return IdentifierQuotingStyle::Backticks;

View File

@ -111,13 +111,11 @@ void processTableFiles(const fs::path & data_path, fs::path dst_path, bool test_
std::shared_ptr<WriteBuffer> directory_meta;
if (test_mode)
{
auto files_root = dst_path / prefix;
directory_meta = std::make_shared<WriteBufferFromHTTP>(HTTPConnectionGroupType::HTTP, Poco::URI(dst_path / directory_prefix / ".index"), Poco::Net::HTTPRequest::HTTP_PUT);
}
else
{
dst_path = fs::canonical(dst_path);
auto files_root = dst_path / prefix;
fs::create_directories(dst_path / directory_prefix);
directory_meta = std::make_shared<WriteBufferFromFile>(dst_path / directory_prefix / ".index");
}

View File

@ -115,15 +115,15 @@ namespace
{
UNKNOWN = -2,
GROUP = -1,
GLOBAL,
DATABASE,
TABLE,
GLOBAL = 0,
DATABASE = 1,
TABLE = 2,
VIEW = TABLE,
COLUMN,
DICTIONARY,
NAMED_COLLECTION,
USER_NAME,
TABLE_ENGINE,
COLUMN = 3,
DICTIONARY = 4,
NAMED_COLLECTION = 5,
USER_NAME = 6,
TABLE_ENGINE = 7,
};
struct Node;

View File

@ -1159,7 +1159,7 @@ void AsynchronousMetrics::update(TimePoint update_time, bool force_update)
core_id = std::stoi(s.substr(core_id_start));
}
else if (s.rfind("cpu MHz", 0) == 0)
else if (s.starts_with("cpu MHz"))
{
if (auto colon = s.find_first_of(':'))
{

View File

@ -424,7 +424,7 @@ public:
if (unlikely(this->c_end + sizeof(T) > this->c_end_of_storage))
this->reserveForNextSize(std::forward<TAllocatorParams>(allocator_params)...);
new (t_end()) T(std::forward<U>(x));
new (reinterpret_cast<void*>(t_end())) T(std::forward<U>(x));
this->c_end += sizeof(T);
}

View File

@ -61,7 +61,7 @@ DynamicResourceManager::State::Resource::Resource(
// Create nodes
bool has_root = false;
for (auto [path, key] : path2key)
for (const auto & [path, key] : path2key)
{
// Validate path
size_t slash = path.rfind('/');

View File

@ -888,7 +888,7 @@ void TestKeeper::multi(
const Requests & requests,
MultiCallback callback)
{
return multi(std::span(requests), std::move(callback));
multi(std::span(requests), std::move(callback));
}
void TestKeeper::multi(

View File

@ -689,21 +689,29 @@ void CompressionCodecT64::doDecompressData(const char * src, UInt32 src_size, ch
switch (baseType(saved_type_id))
{
case TypeIndex::Int8:
return decompressData<Int8>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<Int8>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::Int16:
return decompressData<Int16>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<Int16>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::Int32:
return decompressData<Int32>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<Int32>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::Int64:
return decompressData<Int64>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<Int64>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::UInt8:
return decompressData<UInt8>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<UInt8>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::UInt16:
return decompressData<UInt16>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<UInt16>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::UInt32:
return decompressData<UInt32>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<UInt32>(src, src_size, dst, uncompressed_size, saved_variant);
return;
case TypeIndex::UInt64:
return decompressData<UInt64>(src, src_size, dst, uncompressed_size, saved_variant);
decompressData<UInt64>(src, src_size, dst, uncompressed_size, saved_variant);
return;
default:
break;
}

View File

@ -44,7 +44,7 @@ public:
void setReadUntilPosition(size_t position) override; /// [..., position).
void setReadUntilEnd() override { return setReadUntilPosition(getFileSize()); }
void setReadUntilEnd() override { setReadUntilPosition(getFileSize()); }
size_t getFileOffsetOfBufferEnd() const override { return file_offset_of_buffer_end; }

View File

@ -454,7 +454,7 @@ FunctionBasePtr IFunctionOverloadResolver::build(const ColumnsWithTypeAndName &
void IFunctionOverloadResolver::getLambdaArgumentTypes(DataTypes & arguments [[maybe_unused]]) const
{
checkNumberOfArguments(arguments.size());
return getLambdaArgumentTypesImpl(arguments);
getLambdaArgumentTypesImpl(arguments);
}
DataTypePtr IFunctionOverloadResolver::getReturnTypeWithoutLowCardinality(const ColumnsWithTypeAndName & arguments) const

View File

@ -975,7 +975,7 @@ private:
break;
}
return result_type->createColumnConst(item_arg->size(), static_cast<ResultType>(current));
return result_type->createColumnConst(item_arg->size(), current);
}
else
{

View File

@ -173,7 +173,7 @@ off_t ReadBufferFromFileDescriptor::seek(off_t offset, int whence)
if (new_pos + (working_buffer.end() - pos) == file_offset_of_buffer_end)
return new_pos;
if (file_offset_of_buffer_end - working_buffer.size() <= static_cast<size_t>(new_pos)
if (file_offset_of_buffer_end - working_buffer.size() <= new_pos
&& new_pos <= file_offset_of_buffer_end)
{
/// Position is still inside the buffer.

View File

@ -102,17 +102,17 @@ static inline void writeProbablyQuotedStringImpl(StringRef s, WriteBuffer & buf,
void writeProbablyBackQuotedString(StringRef s, WriteBuffer & buf)
{
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeBackQuotedString(s_, buf_); });
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeBackQuotedString(s_, buf_); });
}
void writeProbablyDoubleQuotedString(StringRef s, WriteBuffer & buf)
{
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeDoubleQuotedString(s_, buf_); });
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeDoubleQuotedString(s_, buf_); });
}
void writeProbablyBackQuotedStringMySQL(StringRef s, WriteBuffer & buf)
{
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { return writeBackQuotedStringMySQL(s_, buf_); });
writeProbablyQuotedStringImpl(s, buf, [](StringRef s_, WriteBuffer & buf_) { writeBackQuotedStringMySQL(s_, buf_); });
}
void writePointerHex(const void * ptr, WriteBuffer & buf)

View File

@ -712,12 +712,12 @@ bool tryParseDateTimeBestEffortUS(time_t & res, ReadBuffer & in, const DateLUTIm
void parseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone)
{
return parseDateTime64BestEffortImpl<void, false>(res, scale, in, local_time_zone, utc_time_zone);
parseDateTime64BestEffortImpl<void, false>(res, scale, in, local_time_zone, utc_time_zone);
}
void parseDateTime64BestEffortUS(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone)
{
return parseDateTime64BestEffortImpl<void, true>(res, scale, in, local_time_zone, utc_time_zone);
parseDateTime64BestEffortImpl<void, true>(res, scale, in, local_time_zone, utc_time_zone);
}
bool tryParseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone)

View File

@ -5,7 +5,6 @@
#include <Common/Exception.h>
#include <Interpreters/Cache/FileSegmentInfo.h>
#include <Interpreters/Cache/Guards.h>
#include <Interpreters/Cache/IFileCachePriority.h>
#include <Interpreters/Cache/FileCache_fwd_internal.h>
#include <Interpreters/Cache/UserInfo.h>

View File

@ -81,7 +81,7 @@ public:
};
PriorityDumpPtr dump(const CachePriorityGuard::Lock &) override;
void pop(const CachePriorityGuard::Lock & lock) { remove(queue.begin(), lock); }
void pop(const CachePriorityGuard::Lock & lock) { remove(queue.begin(), lock); } // NOLINT
bool modifySizeLimits(size_t max_size_, size_t max_elements_, double size_ratio_, const CachePriorityGuard::Lock &) override;

View File

@ -110,17 +110,17 @@ public:
/// Returns the result of loading the object.
/// The function doesn't load anything, it just returns the current load result as is.
template <typename ReturnType = LoadResult, typename = std::enable_if_t<is_scalar_load_result_type<ReturnType>, void>>
template <typename ReturnType = LoadResult, typename = std::enable_if_t<is_scalar_load_result_type<ReturnType>, void>> // NOLINT
ReturnType getLoadResult(const String & name) const;
using FilterByNameFunction = std::function<bool(const String &)>;
/// Returns all the load results as a map.
/// The function doesn't load anything, it just returns the current load results as is.
template <typename ReturnType = LoadResults, typename = std::enable_if_t<is_vector_load_result_type<ReturnType>, void>>
template <typename ReturnType = LoadResults, typename = std::enable_if_t<is_vector_load_result_type<ReturnType>, void>> // NOLINT
ReturnType getLoadResults() const { return getLoadResults<ReturnType>(FilterByNameFunction{}); }
template <typename ReturnType = LoadResults, typename = std::enable_if_t<is_vector_load_result_type<ReturnType>, void>>
template <typename ReturnType = LoadResults, typename = std::enable_if_t<is_vector_load_result_type<ReturnType>, void>> // NOLINT
ReturnType getLoadResults(const FilterByNameFunction & filter) const;
/// Returns all loaded objects as a map.

View File

@ -40,7 +40,6 @@ BlockIO InterpreterRenameQuery::execute()
getContext()->checkAccess(getRequiredAccess(rename.database ? RenameType::RenameDatabase : RenameType::RenameTable));
String path = getContext()->getPath();
String current_database = getContext()->getCurrentDatabase();
/** In case of error while renaming, it is possible that only part of tables was renamed

View File

@ -671,7 +671,8 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
if (written)
{
return finishFormatWithWindow(settings, state, frame);
finishFormatWithWindow(settings, state, frame);
return;
}
settings.ostr << (settings.hilite ? hilite_function : "") << name;
@ -753,8 +754,7 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
settings.ostr << (settings.hilite ? hilite_function : "") << ')';
settings.ostr << (settings.hilite ? hilite_none : "");
return finishFormatWithWindow(settings, state, frame);
finishFormatWithWindow(settings, state, frame);
}
bool ASTFunction::hasSecretParts() const

View File

@ -285,8 +285,6 @@ void ASTTablesInSelectQueryElement::formatImpl(const FormatSettings & settings,
void ASTTablesInSelectQuery::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
{
std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' ');
for (const auto & child : children)
child->formatImpl(settings, state, frame);
}

View File

@ -219,7 +219,7 @@ namespace
void throwIfNotGrantable(AccessRightsElements & elements)
{
boost::range::remove_erase_if(elements, [](AccessRightsElement & element)
boost::range::remove_erase_if(elements, [](AccessRightsElement & element) // NOLINT
{
if (element.empty())
return true;

View File

@ -137,7 +137,6 @@ bool DatatypeInt::convertImpl(String & out, IParser::Pos & pos)
const String fn_name = getKQLFunctionName(pos);
if (fn_name.empty())
return false;
String guid_str;
++pos;
if (pos->type == TokenType::QuotedIdentifier || pos->type == TokenType::StringLiteral)

View File

@ -240,7 +240,7 @@ void inline getTokens(String format, std::vector<String> & res)
pos = str.find_first_not_of("abcdefghijklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM");
}
// Cover the last (or only) token
if (str.length() > 0)
if (!str.empty())
{
token = str;
res.insert(res.begin(), token);

View File

@ -92,9 +92,7 @@ void writeQueryWithHighlightedErrorPositions(
}
else
{
ssize_t bytes_to_hilite = UTF8::seqLength(*current_position_to_hilite);
if (bytes_to_hilite > end - current_position_to_hilite)
bytes_to_hilite = end - current_position_to_hilite;
ssize_t bytes_to_hilite = std::min<ssize_t>(UTF8::seqLength(*current_position_to_hilite), end - current_position_to_hilite);
/// Bright on red background.
out << "\033[41;1m";

View File

@ -62,7 +62,7 @@ public:
size_t max_block_size,
size_t num_streams) override
{
return getNested()->read(query_plan, column_names, storage_snapshot, query_info, context, processed_stage, max_block_size, num_streams);
getNested()->read(query_plan, column_names, storage_snapshot, query_info, context, processed_stage, max_block_size, num_streams);
}
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & metadata_snapshot, ContextPtr context, bool async_insert) override