Address review nits · rust-lang/rust@c373d20

File tree

3 files changed

lines changed

  • tests/ui/async-await/in-trait

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -6,7 +6,7 @@ lint_array_into_iter =

66

or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value

77
88

lint_async_fn_in_trait = use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified

9-

.note = you can suppress this lint if you plan to use the trait locally, for concrete types, or do not care about auto traits like `Send` on the `Future`

9+

.note = you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`

1010

.suggestion = you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`

1111
1212

lint_atomic_ordering_fence = memory fences cannot have `Relaxed` ordering

Original file line numberDiff line numberDiff line change

@@ -39,8 +39,8 @@ declare_lint! {

3939

/// }

4040

///

4141

/// fn test<T: Trait>(x: T) {

42-

/// fn is_send<T: Send>(_: T) {}

43-

/// is_send(x.method()); // Not OK.

42+

/// fn spawn<T: Send>(_: T) {}

43+

/// spawn(x.method()); // Not OK.

4444

/// }

4545

/// ```

4646

///

@@ -68,11 +68,10 @@ declare_lint! {

6868

/// }

6969

/// ```

7070

///

71-

/// Conversely, if the trait is used only locally, if only concrete types

72-

/// that implement the trait are used, or if the trait author otherwise

73-

/// does not care that the trait will not promise that the returned

74-

/// [`Future`] implements any [auto traits] such as [`Send`], then the

75-

/// lint may be suppressed.

71+

/// Conversely, if the trait is used only locally, if it is never used in

72+

/// generic functions, or if it is only used in single-threaded contexts

73+

/// that do not care whether the returned [`Future`] implements [auto traits]

74+

/// such as [`Send`], then the lint may be suppressed.

7675

///

7776

/// [`Future`]: https://doc.rust-lang.org/core/future/trait.Future.html

7877

/// [`Send`]: https://doc.rust-lang.org/core/marker/trait.Send.html

Original file line numberDiff line numberDiff line change

@@ -4,7 +4,7 @@ error: use of `async fn` in public traits is discouraged as auto trait bounds ca

44

LL | async fn not_send();

55

| ^^^^^

66

|

7-

= note: you can suppress this lint if you plan to use the trait locally, for concrete types, or do not care about auto traits like `Send` on the `Future`

7+

= note: you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`

88

note: the lint level is defined here

99

--> $DIR/warn.rs:4:9

1010

|