Skip to content

Commit fbfdaec

Browse files
authored
Fix clang-tidy benign warnings (#185)
1 parent e3e9e09 commit fbfdaec

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

.clang-tidy

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
Checks:
3-
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,-modernize-use-trailing-return-type'
3+
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,
4+
-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-readability-identifier-length'
45
WarningsAsErrors: '*'
56
HeaderFilterRegex: 'include/aws/.*\.h$'
67
FormatStyle: 'none'

ci/codebuild/format-check.sh

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ FAIL=0
1313
SOURCE_FILES=$(find src include tests -type f -name "*.h" -o -name "*.cpp")
1414
for i in $SOURCE_FILES
1515
do
16+
if [[ "$i" == *"gtest.h" || "$i" == *"backward.h" ]]; then
17+
continue
18+
fi
19+
20+
echo "$i\n"
1621
if [ $($CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement ") -ne 0 ]
1722
then
1823
echo "$i failed clang-format check."

include/aws/lambda-runtime/runtime.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ class invocation_response {
129129
bool is_success() const { return m_success; }
130130
};
131131

132-
struct no_result {
133-
};
132+
struct no_result {};
134133

135134
class runtime {
136135
public:

src/runtime.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cassert>
2626
#include <chrono>
2727
#include <array>
28+
#include <iterator>
2829
#include <cstdlib> // for strtoul
2930
#include <cinttypes>
3031

@@ -133,12 +134,16 @@ static size_t read_data(char* buffer, size_t size, size_t nitems, void* userdata
133134
}
134135

135136
if (unread <= limit) {
136-
std::copy_n(ctx->first.begin() + ctx->second, unread, buffer);
137+
auto from = ctx->first.begin();
138+
std::advance(from, ctx->second);
139+
std::copy_n(from, unread, buffer);
137140
ctx->second += unread;
138141
return unread;
139142
}
140143

141-
std::copy_n(ctx->first.begin() + ctx->second, limit, buffer);
144+
auto from = ctx->first.begin();
145+
std::advance(from, ctx->second);
146+
std::copy_n(from, limit, buffer);
142147
ctx->second += limit;
143148
return limit;
144149
}

0 commit comments

Comments
 (0)