refactor: fix modernize-return-braced-init-list warnings (#44857)

* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]

NB: using the braced-initializer list uncovered an error here:
the float returned by std::floor() can't be implicitly cast to
an int. This is solved by using base::ClampFloor<int>() instead.
std::floor()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-11-26 22:18:00 -06:00 committed by GitHub
parent 7152209fb5
commit cd6e3d720f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 79 additions and 81 deletions

View file

@ -63,8 +63,7 @@ scoped_refptr<base::SequencedTaskRunner> CreateFileTaskRunner() {
}
base::File OpenFileForWriting(base::FilePath path) {
return base::File(path,
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
return {path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE};
}
void ResolvePromiseWithNetError(gin_helper::Promise<void> promise,
@ -93,7 +92,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
gin::Arguments* args) {
if (log_path.empty()) {
args->ThrowTypeError("The first parameter must be a valid string");
return v8::Local<v8::Promise>();
return {};
}
net::NetLogCaptureMode capture_mode = net::NetLogCaptureMode::kDefault;
@ -106,7 +105,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
if (!gin::ConvertFromV8(args->isolate(), capture_mode_v8,
&capture_mode)) {
args->ThrowTypeError("Invalid value for captureMode");
return v8::Local<v8::Promise>();
return {};
}
}
v8::Local<v8::Value> max_file_size_v8;
@ -114,14 +113,14 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
if (!gin::ConvertFromV8(args->isolate(), max_file_size_v8,
&max_file_size)) {
args->ThrowTypeError("Invalid value for maxFileSize");
return v8::Local<v8::Promise>();
return {};
}
}
}
if (net_log_exporter_) {
args->ThrowTypeError("There is already a net log running");
return v8::Local<v8::Promise>();
return {};
}
pending_start_promise_ =