fix: modernize-use-nodiscard clang-tidy warnings (#44833)

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-25 13:55:56 -05:00 committed by GitHub
parent 5a0e1ccf73
commit c0d1c3481a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 14 additions and 14 deletions

View file

@ -86,7 +86,7 @@ class ElectronPermissionManager::PendingRequest {
return content::RenderFrameHost::FromID(render_frame_host_id_);
}
bool IsComplete() const { return remaining_results_ == 0; }
[[nodiscard]] bool IsComplete() const { return remaining_results_ == 0; }
void RunCallback() {
if (!callback_.is_null()) {

View file

@ -135,15 +135,15 @@ class ElectronDelegatedFrameHostClient
const ElectronDelegatedFrameHostClient&) = delete;
// content::DelegatedFrameHostClient
ui::Layer* DelegatedFrameHostGetLayer() const override {
[[nodiscard]] ui::Layer* DelegatedFrameHostGetLayer() const override {
return view_->root_layer();
}
bool DelegatedFrameHostIsVisible() const override {
[[nodiscard]] bool DelegatedFrameHostIsVisible() const override {
return view_->IsShowing();
}
SkColor DelegatedFrameHostGetGutterColor() const override {
[[nodiscard]] SkColor DelegatedFrameHostGetGutterColor() const override {
if (view_->render_widget_host()->delegate() &&
view_->render_widget_host()->delegate()->IsFullscreen()) {
return SK_ColorWHITE;
@ -156,7 +156,7 @@ class ElectronDelegatedFrameHostClient
view_->render_widget_host()->DidProcessFrame(frame_token, activation_time);
}
float GetDeviceScaleFactor() const override {
[[nodiscard]] float GetDeviceScaleFactor() const override {
return view_->GetDeviceScaleFactor();
}

View file

@ -149,7 +149,7 @@ class BufferDataSource : public mojo::DataPipeProducer::DataSource {
private:
// mojo::DataPipeProducer::DataSource:
uint64_t GetLength() const override { return buffer_.size(); }
[[nodiscard]] uint64_t GetLength() const override { return buffer_.size(); }
ReadResult Read(uint64_t offset, base::span<char> buffer) override {
ReadResult result;
if (offset <= buffer_.size()) {

View file

@ -38,12 +38,12 @@ class ElectronPermissionMessageProvider
const ElectronPermissionMessageProvider&) = delete;
// PermissionMessageProvider implementation.
extensions::PermissionMessages GetPermissionMessages(
[[nodiscard]] extensions::PermissionMessages GetPermissionMessages(
const extensions::PermissionIDSet& permissions) const override {
return extensions::PermissionMessages();
}
bool IsPrivilegeIncrease(
[[nodiscard]] bool IsPrivilegeIncrease(
const extensions::PermissionSet& granted_permissions,
const extensions::PermissionSet& requested_permissions,
extensions::Manifest::Type extension_type) const override {
@ -52,7 +52,7 @@ class ElectronPermissionMessageProvider
return false;
}
extensions::PermissionIDSet GetAllPermissionIDs(
[[nodiscard]] extensions::PermissionIDSet GetAllPermissionIDs(
const extensions::PermissionSet& permissions,
extensions::Manifest::Type extension_type) const override {
return extensions::PermissionIDSet();

View file

@ -54,7 +54,7 @@ struct OffscreenReleaseHolderMonitor {
holder_ = nullptr;
}
bool IsTextureReleased() const { return holder_ == nullptr; }
[[nodiscard]] bool IsTextureReleased() const { return holder_ == nullptr; }
v8::Persistent<v8::Value>* CreatePersistent(v8::Isolate* isolate,
v8::Local<v8::Value> value) {

View file

@ -88,7 +88,7 @@ class RefCountedGlobal
RefCountedGlobal(v8::Isolate* isolate, v8::Local<v8::Value> value)
: handle_(isolate, value.As<T>()) {}
bool IsAlive() const { return !handle_.IsEmpty(); }
[[nodiscard]] bool IsAlive() const { return !handle_.IsEmpty(); }
v8::Local<T> NewHandle(v8::Isolate* isolate) const {
return v8::Local<T>::New(isolate, handle_);

View file

@ -18,7 +18,7 @@ class HeapSnapshotOutputStream : public v8::OutputStream {
DCHECK(file_);
}
bool IsComplete() const { return is_complete_; }
[[nodiscard]] bool IsComplete() const { return is_complete_; }
// v8::OutputStream
int GetChunkSize() override { return 65536; }

View file

@ -58,7 +58,7 @@ class SpellCheckClient::SpellcheckRequest {
SpellcheckRequest& operator=(const SpellcheckRequest&) = delete;
~SpellcheckRequest() = default;
const std::u16string& text() const { return text_; }
[[nodiscard]] const std::u16string& text() const { return text_; }
blink::WebTextCheckingCompletion* completion() { return completion_.get(); }
std::vector<Word>& wordlist() { return word_list_; }

View file

@ -131,7 +131,7 @@ class ChromePdfInternalPluginDelegate final
~ChromePdfInternalPluginDelegate() override = default;
// `pdf::PdfInternalPluginDelegate`:
bool IsAllowedOrigin(const url::Origin& origin) const override {
[[nodiscard]] bool IsAllowedOrigin(const url::Origin& origin) const override {
return origin.scheme() == extensions::kExtensionScheme &&
origin.host() == extension_misc::kPdfExtensionId;
}