Remove a redundant map access.
Change-Id: I37de97f08d37e4de0f413ef5248f9d55e2b168b3
Reviewed-on: https://code-review.googlesource.com/c/re2/+/59490
Reviewed-by: Matthew Fowles Kulukundis <kfm@google.com>
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/regexp.cc b/re2/regexp.cc
index 2e1bfac..ca1318b 100644
--- a/re2/regexp.cc
+++ b/re2/regexp.cc
@@ -585,8 +585,7 @@
// Record first occurrence of each name.
// (The rule is that if you have the same name
// multiple times, only the leftmost one counts.)
- if (map_->find(*re->name()) == map_->end())
- (*map_)[*re->name()] = re->cap();
+ map_->insert({*re->name(), re->cap()});
}
return ignored;
}