Skip to content

Commit 6d60066

Browse files
committed
Add Sugg::asyncify
1 parent 533cb21 commit 6d60066

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clippy_utils/src/sugg.rs

+6
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ impl<'a> Sugg<'a> {
315315
Sugg::NonParen(Cow::Owned(format!("{{ {} }}", self)))
316316
}
317317

318+
/// Convenience method to prefix the expression with the `async` keyword.
319+
/// Can be used after `blockify` to create an async block.
320+
pub fn asyncify(self) -> Sugg<'static> {
321+
Sugg::NonParen(Cow::Owned(format!("async {}", self)))
322+
}
323+
318324
/// Convenience method to create the `<lhs>..<rhs>` or `<lhs>...<rhs>`
319325
/// suggestion.
320326
pub fn range(self, end: &Self, limit: ast::RangeLimits) -> Sugg<'static> {

0 commit comments

Comments
 (0)