Skip to content

Commit 1f3e169

Browse files
committed
Remove nasty move-onto-self test and support
1 parent 07c40c6 commit 1f3e169

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/RegExp.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "RegExp.h"
44

55
RegExp::RegExp(const std::string &regex)
6-
: RegExp(regex.c_str()) { }
6+
: RegExp(regex.c_str()) {}
77

88
RegExp::RegExp(const char *regex) {
99
R(regcomp(&re_, regex, REG_EXTENDED), regex);
@@ -61,11 +61,9 @@ RegExp::RegExp(RegExp &&exp)
6161
}
6262

6363
RegExp &RegExp::operator=(RegExp &&exp) {
64-
if (this != &exp) {
65-
release();
66-
re_ = exp.re_;
67-
exp.owned_ = false;
68-
owned_ = true;
69-
}
64+
release();
65+
re_ = exp.re_;
66+
exp.owned_ = false;
67+
owned_ = true;
7068
return *this;
7169
}

tests/RegExpTest.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ TEST_CASE("moves", "[RegExp]") {
5353
RegExp r("[a-z]+");
5454
RegExp::Matches matches;
5555
REQUIRE(r.exec("moo", matches) == true);
56-
r = std::move(r);
57-
REQUIRE(r.exec("moo", matches) == true);
5856
RegExp nR("1234");
5957
nR = std::move(r);
6058
REQUIRE(r.exec("moo", matches) == true);

0 commit comments

Comments
 (0)