fix CI: generate doctest

This commit is contained in:
Young-Flash 2023-10-12 11:50:44 +08:00
parent a7fada4650
commit 3605bb38ff
2 changed files with 22 additions and 3 deletions

View File

@ -2,7 +2,7 @@ use syntax::ast::{self, AstNode};
use crate::{AssistContext, AssistId, AssistKind, Assists};
// Assist: replace_is_some_with_if_let
// Assist: replace_is_some_with_if_let_some
//
// Replace `if x.is_some()` with `if let Some(_tmp) = x`.
//
@ -57,7 +57,7 @@ mod tests {
use super::replace_is_some_with_if_let_some;
#[test]
fn replace_is_some_with_if_let_works() {
fn replace_is_some_with_if_let_some_works() {
check_assist(
replace_is_some_with_if_let_some,
r#"
@ -76,7 +76,7 @@ fn main() {
}
#[test]
fn replace_is_some_with_if_let_not_applicable() {
fn replace_is_some_with_if_let_some_not_applicable() {
check_assist_not_applicable(
replace_is_some_with_if_let_some,
r#"

View File

@ -2558,6 +2558,25 @@ fn handle(action: Action) {
)
}
#[test]
fn doctest_replace_is_some_with_if_let_some() {
check_doc_test(
"replace_is_some_with_if_let_some",
r#####"
fn main() {
let x = Some(1);
if x.is_som$0e() {}
}
"#####,
r#####"
fn main() {
let x = Some(1);
if let Some(_tmp) = x {}
}
"#####,
)
}
#[test]
fn doctest_replace_let_with_if_let() {
check_doc_test(