Skip to content

Commit edeb492

Browse files
committed
minor: fix test style
1 parent 5637ce4 commit edeb492

File tree

2 files changed

+31
-67
lines changed

2 files changed

+31
-67
lines changed

crates/ide/src/join_lines.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ fn remove_newlines(edit: &mut TextEditBuilder, token: &SyntaxToken, range: TextR
6767

6868
fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextSize) {
6969
if token.kind() != WHITESPACE || token.text().bytes().filter(|&b| b == b'\n').count() != 1 {
70-
let mut no_space = false;
71-
if let Some(string) = ast::String::cast(token.clone()) {
72-
if let Some(range) = string.open_quote_text_range() {
73-
cov_mark::hit!(join_string_literal_open_quote);
74-
no_space |= range.end() == offset;
75-
}
76-
if let Some(range) = string.close_quote_text_range() {
77-
cov_mark::hit!(join_string_literal_close_quote);
78-
no_space |= range.start() == offset + TextSize::of('\n');
79-
}
80-
}
81-
8270
let n_spaces_after_line_break = {
8371
let suff = &token.text()[TextRange::new(
8472
offset - token.text_range().start() + TextSize::of('\n'),

crates/ide_assists/src/handlers/replace_impl_trait_with_generic.rs

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -55,51 +55,35 @@ mod tests {
5555
fn replace_impl_trait_with_generic_params() {
5656
check_assist(
5757
replace_impl_trait_with_generic,
58-
r#"
59-
fn foo<G>(bar: $0impl Bar) {}
60-
"#,
61-
r#"
62-
fn foo<G, B: Bar>(bar: B) {}
63-
"#,
58+
r#"fn foo<G>(bar: $0impl Bar) {}"#,
59+
r#"fn foo<G, B: Bar>(bar: B) {}"#,
6460
);
6561
}
6662

6763
#[test]
6864
fn replace_impl_trait_without_generic_params() {
6965
check_assist(
7066
replace_impl_trait_with_generic,
71-
r#"
72-
fn foo(bar: $0impl Bar) {}
73-
"#,
74-
r#"
75-
fn foo<B: Bar>(bar: B) {}
76-
"#,
67+
r#"fn foo(bar: $0impl Bar) {}"#,
68+
r#"fn foo<B: Bar>(bar: B) {}"#,
7769
);
7870
}
7971

8072
#[test]
8173
fn replace_two_impl_trait_with_generic_params() {
8274
check_assist(
8375
replace_impl_trait_with_generic,
84-
r#"
85-
fn foo<G>(foo: impl Foo, bar: $0impl Bar) {}
86-
"#,
87-
r#"
88-
fn foo<G, B: Bar>(foo: impl Foo, bar: B) {}
89-
"#,
76+
r#"fn foo<G>(foo: impl Foo, bar: $0impl Bar) {}"#,
77+
r#"fn foo<G, B: Bar>(foo: impl Foo, bar: B) {}"#,
9078
);
9179
}
9280

9381
#[test]
9482
fn replace_impl_trait_with_empty_generic_params() {
9583
check_assist(
9684
replace_impl_trait_with_generic,
97-
r#"
98-
fn foo<>(bar: $0impl Bar) {}
99-
"#,
100-
r#"
101-
fn foo<B: Bar>(bar: B) {}
102-
"#,
85+
r#"fn foo<>(bar: $0impl Bar) {}"#,
86+
r#"fn foo<B: Bar>(bar: B) {}"#,
10387
);
10488
}
10589

@@ -108,13 +92,13 @@ mod tests {
10892
check_assist(
10993
replace_impl_trait_with_generic,
11094
r#"
111-
fn foo<
112-
>(bar: $0impl Bar) {}
113-
"#,
95+
fn foo<
96+
>(bar: $0impl Bar) {}
97+
"#,
11498
r#"
115-
fn foo<B: Bar
116-
>(bar: B) {}
117-
"#,
99+
fn foo<B: Bar
100+
>(bar: B) {}
101+
"#,
118102
);
119103
}
120104

@@ -123,12 +107,8 @@ mod tests {
123107
fn replace_impl_trait_with_exist_generic_letter() {
124108
check_assist(
125109
replace_impl_trait_with_generic,
126-
r#"
127-
fn foo<B>(bar: $0impl Bar) {}
128-
"#,
129-
r#"
130-
fn foo<B, C: Bar>(bar: C) {}
131-
"#,
110+
r#"fn foo<B>(bar: $0impl Bar) {}"#,
111+
r#"fn foo<B, C: Bar>(bar: C) {}"#,
132112
);
133113
}
134114

@@ -137,32 +117,28 @@ mod tests {
137117
check_assist(
138118
replace_impl_trait_with_generic,
139119
r#"
140-
fn foo<
141-
G: Foo,
142-
F,
143-
H,
144-
>(bar: $0impl Bar) {}
145-
"#,
146-
r#"
147-
fn foo<
148-
G: Foo,
149-
F,
150-
H, B: Bar
151-
>(bar: B) {}
152-
"#,
120+
fn foo<
121+
G: Foo,
122+
F,
123+
H,
124+
>(bar: $0impl Bar) {}
125+
"#,
126+
r#"
127+
fn foo<
128+
G: Foo,
129+
F,
130+
H, B: Bar
131+
>(bar: B) {}
132+
"#,
153133
);
154134
}
155135

156136
#[test]
157137
fn replace_impl_trait_multiple() {
158138
check_assist(
159139
replace_impl_trait_with_generic,
160-
r#"
161-
fn foo(bar: $0impl Foo + Bar) {}
162-
"#,
163-
r#"
164-
fn foo<F: Foo + Bar>(bar: F) {}
165-
"#,
140+
r#"fn foo(bar: $0impl Foo + Bar) {}"#,
141+
r#"fn foo<F: Foo + Bar>(bar: F) {}"#,
166142
);
167143
}
168144
}

0 commit comments

Comments
 (0)