Skip to content

Commit f05170f

Browse files
committed
Mark [[nodiscard]] for cancellation-related functions in cancellation_source.
1 parent 6c9c0ce commit f05170f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/cppcoro/cancellation_source.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ namespace cppcoro
3838
/// A cancellation source object will not be cancellable if it has
3939
/// previously been moved into another cancellation_source instance
4040
/// or was copied from a cancellation_source that was not cancellable.
41-
bool can_be_cancelled() const noexcept;
41+
[[nodiscard]] bool can_be_cancelled() const noexcept;
4242

4343
/// Obtain a cancellation token that can be used to query if
4444
/// cancellation has been requested on this source.
4545
///
4646
/// The cancellation token can be passed into functions that you
4747
/// may want to later be able to request cancellation.
48-
cancellation_token token() const noexcept;
48+
[[nodiscard]] cancellation_token token() const noexcept;
4949

5050
/// Request cancellation of operations that were passed an associated
5151
/// cancellation token.
@@ -59,7 +59,7 @@ namespace cppcoro
5959

6060
/// Query if some thread has called 'request_cancellation()' on this
6161
/// cancellation_source.
62-
bool is_cancellation_requested() const noexcept;
62+
[[nodiscard]] bool is_cancellation_requested() const noexcept;
6363

6464
private:
6565

0 commit comments

Comments
 (0)