chore: prefer empty() check for readability (#29360)
This commit is contained in:
parent
77ecc7d432
commit
9bb7051f54
4 changed files with 5 additions and 6 deletions
|
@ -177,7 +177,7 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
|
|||
v8::Isolate* isolate,
|
||||
const std::vector<gin::Handle<MessagePort>>& ports,
|
||||
bool* threw_exception) {
|
||||
if (!ports.size())
|
||||
if (ports.empty())
|
||||
return std::vector<blink::MessagePortChannel>();
|
||||
|
||||
std::unordered_set<MessagePort*> visited;
|
||||
|
|
|
@ -54,7 +54,7 @@ std::pair<scoped_refptr<const Extension>, std::string> LoadUnpacked(
|
|||
|
||||
std::string warnings;
|
||||
// Log warnings.
|
||||
if (extension->install_warnings().size()) {
|
||||
if (!extension->install_warnings().empty()) {
|
||||
warnings += "Warnings loading extension at " +
|
||||
base::UTF16ToUTF8(extension_dir.LossyDisplayName()) + ":\n";
|
||||
for (const auto& warning : extension->install_warnings()) {
|
||||
|
|
|
@ -162,8 +162,7 @@ void FileSelectHelper::OnOpenDialogDone(gin_helper::Dictionary result) {
|
|||
std::vector<ui::SelectedFileInfo> files =
|
||||
ui::FilePathListToSelectedFileInfoList(paths);
|
||||
// If we are uploading a folder we need to enumerate its contents
|
||||
if (mode_ == FileChooserParams::Mode::kUploadFolder &&
|
||||
paths.size() >= 1) {
|
||||
if (mode_ == FileChooserParams::Mode::kUploadFolder && !paths.empty()) {
|
||||
lister_base_dir_ = paths[0];
|
||||
EnumerateDirectory();
|
||||
} else {
|
||||
|
|
|
@ -58,7 +58,7 @@ bool GetChildNode(const base::DictionaryValue* root,
|
|||
const std::string& name,
|
||||
const base::DictionaryValue* dir,
|
||||
const base::DictionaryValue** out) {
|
||||
if (name == "") {
|
||||
if (name.empty()) {
|
||||
*out = root;
|
||||
return true;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ bool GetChildNode(const base::DictionaryValue* root,
|
|||
bool GetNodeFromPath(std::string path,
|
||||
const base::DictionaryValue* root,
|
||||
const base::DictionaryValue** out) {
|
||||
if (path == "") {
|
||||
if (path.empty()) {
|
||||
*out = root;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue