Skip to content

Commit 30061d4

Browse files
authored
Fix cpplint errors in paddle/fluid/string (#9667)
* Fix cpplint errors in paddle/fluid/string * Fix unit test error * Correct
1 parent 49c665b commit 30061d4

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

paddle/fluid/string/piece.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "piece.h"
15+
#include "paddle/fluid/string/piece.h"
1616

1717
#include <string.h>
1818

paddle/fluid/string/printf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171

7272
#include <iostream>
7373
#include <sstream>
74+
#include <string>
75+
7476
#include "tinyformat/tinyformat.h" // https://github.com/c42f/tinyformat
7577

7678
namespace paddle {

paddle/fluid/string/printf_test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
#include "printf.h"
14+
15+
#include "paddle/fluid/string/printf.h"
1516

1617
#include <string>
1718

@@ -21,7 +22,7 @@ TEST(StringPrintf, StringPrintf) {
2122
std::string weekday = "Wednesday";
2223
const char* month = "July";
2324
size_t day = 27;
24-
long hour = 14;
25+
int hour = 14;
2526
int min = 44;
2627
EXPECT_EQ(std::string("Wednesday, July 27, 14:44"),
2728
paddle::string::Sprintf("%s, %s %d, %.2d:%.2d", weekday, month, day,

paddle/fluid/string/to_string_test.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

15-
#include "to_string.h"
15+
#include "paddle/fluid/string/to_string.h"
1616
#include <gtest/gtest.h>
1717

1818
constexpr char kOutputString[] = "User Defined Output";
@@ -26,14 +26,13 @@ std::ostream& operator<<(std::ostream& s, const UserDefinedClass& ins) {
2626
}
2727

2828
TEST(to_string, normal) {
29-
using namespace paddle::string;
29+
using paddle::string::to_string;
3030
ASSERT_EQ("10", to_string(10));
3131
ASSERT_EQ("abc", to_string("abc"));
3232
ASSERT_EQ("1.2", to_string(1.2));
3333
}
3434

3535
TEST(to_string, user_defined) {
36-
using namespace paddle::string;
3736
UserDefinedClass instance;
38-
ASSERT_EQ(kOutputString, to_string(instance));
37+
ASSERT_EQ(kOutputString, paddle::string::to_string(instance));
3938
}

0 commit comments

Comments
 (0)