add sourcegen
This commit is contained in:
parent
05e58afde2
commit
765d7f20f9
@ -24,10 +24,10 @@
|
|||||||
// ```
|
// ```
|
||||||
// ->
|
// ->
|
||||||
// ```
|
// ```
|
||||||
//let pat = match Some(true) {
|
// let pat = match Some(true) {
|
||||||
// Some(it) => it,
|
// Some(it) => it,
|
||||||
// None => return None,
|
// None => return None,
|
||||||
//};
|
// };
|
||||||
// ```
|
// ```
|
||||||
pub(crate) fn replace_try_expr_with_match(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
pub(crate) fn replace_try_expr_with_match(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
||||||
let qm_kw = ctx.find_token_syntax_at_offset(T![?])?;
|
let qm_kw = ctx.find_token_syntax_at_offset(T![?])?;
|
||||||
|
@ -1720,6 +1720,22 @@ fn main() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn doctest_replace_try_expr_with_match() {
|
||||||
|
check_doc_test(
|
||||||
|
"replace_try_expr_with_match",
|
||||||
|
r#####"
|
||||||
|
let pat = Some(true)$0?;
|
||||||
|
"#####,
|
||||||
|
r#####"
|
||||||
|
let pat = match Some(true) {
|
||||||
|
Some(it) => it,
|
||||||
|
None => return None,
|
||||||
|
};
|
||||||
|
"#####,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn doctest_sort_items() {
|
fn doctest_sort_items() {
|
||||||
check_doc_test(
|
check_doc_test(
|
||||||
|
Loading…
Reference in New Issue
Block a user