mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
additional test without further usages
This commit is contained in:
parent
95cabfd722
commit
5beddf93e7
1 changed files with 32 additions and 1 deletions
|
@ -4337,7 +4337,7 @@ fn $0fun_name(a: _) -> _ {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_jeroen() {
|
||||
fn reference_mutable_param_with_further_usages() {
|
||||
check_assist(
|
||||
extract_function,
|
||||
r#"
|
||||
|
@ -4365,6 +4365,37 @@ pub fn testfn(arg: &mut Foo) {
|
|||
println!("{}", arg.field); // read access
|
||||
}
|
||||
|
||||
fn $0fun_name(arg: &mut Foo) {
|
||||
arg.field = 8;
|
||||
println!("{}", arg.field);
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reference_mutable_param_without_further_usages() {
|
||||
check_assist(
|
||||
extract_function,
|
||||
r#"
|
||||
pub struct Foo {
|
||||
field: u32,
|
||||
}
|
||||
|
||||
pub fn testfn(arg: &mut Foo) {
|
||||
$0arg.field = 8; // write access
|
||||
println!("{}", arg.field); // read access$0
|
||||
}
|
||||
"#,
|
||||
r#"
|
||||
pub struct Foo {
|
||||
field: u32,
|
||||
}
|
||||
|
||||
pub fn testfn(arg: &mut Foo) {
|
||||
fun_name(arg); // read access
|
||||
}
|
||||
|
||||
fn $0fun_name(arg: &mut Foo) {
|
||||
arg.field = 8;
|
||||
println!("{}", arg.field);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue