Skip to content

Commit 8949360

Browse files
committed
fix format
1 parent d02f6f2 commit 8949360

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/tools/rust-analyzer/crates/ide/src/inlay_hints/adjustment.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,37 +161,37 @@ pub(super) fn hints(
161161
PointerCast::ReifyFnPointer => (
162162
"<fn-item-to-fn-pointer>",
163163
"fn item to fn pointer",
164-
"Converts a named function to a function pointer `fn()`. Useful when passing functions as values."
164+
"Converts a named function to a function pointer `fn()`. Useful when passing functions as values.",
165165
),
166166
PointerCast::UnsafeFnPointer => (
167167
"<safe-fn-pointer-to-unsafe-fn-pointer>",
168168
"safe fn pointer to unsafe fn pointer",
169-
"Coerces a safe function pointer to an unsafe one. Allows calling it in an unsafe context."
169+
"Coerces a safe function pointer to an unsafe one. Allows calling it in an unsafe context.",
170170
),
171171
PointerCast::ClosureFnPointer(Safety::Unsafe) => (
172172
"<closure-to-unsafe-fn-pointer>",
173173
"closure to unsafe fn pointer",
174-
"Converts a non-capturing closure to an unsafe function pointer. Required for use in `extern` or unsafe APIs."
174+
"Converts a non-capturing closure to an unsafe function pointer. Required for use in `extern` or unsafe APIs.",
175175
),
176176
PointerCast::ClosureFnPointer(Safety::Safe) => (
177177
"<closure-to-fn-pointer>",
178178
"closure to fn pointer",
179-
"Converts a non-capturing closure to a function pointer. Lets closures behave like plain functions."
179+
"Converts a non-capturing closure to a function pointer. Lets closures behave like plain functions.",
180180
),
181181
PointerCast::MutToConstPointer => (
182182
"<mut-ptr-to-const-ptr>",
183183
"mut ptr to const ptr",
184-
"Coerces `*mut T` to `*const T`. Safe because const pointers restrict what you can do."
184+
"Coerces `*mut T` to `*const T`. Safe because const pointers restrict what you can do.",
185185
),
186186
PointerCast::ArrayToPointer => (
187187
"<array-ptr-to-element-ptr>",
188188
"array to pointer",
189-
"Converts an array to a pointer to its first element. Similar to how arrays decay to pointers in C."
189+
"Converts an array to a pointer to its first element. Similar to how arrays decay to pointers in C.",
190190
),
191191
PointerCast::Unsize => (
192192
"<unsize>",
193193
"unsize coercion",
194-
"Converts a sized type to an unsized one. Used for things like turning arrays into slices or concrete types into trait objects."
194+
"Converts a sized type to an unsized one. Used for things like turning arrays into slices or concrete types into trait objects.",
195195
),
196196
}
197197
}

src/tools/rust-analyzer/crates/ide/src/inlay_hints/closing_brace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ fn format_function_hint(func: &ast::Fn, max_length: usize) -> Option<String> {
172172
format!("_: {}", ty)
173173
} else {
174174
let param_source = param.syntax().text().to_string();
175-
if param_source.trim() == "..." { "...".to_string() } else { "_".to_string() }
175+
if param_source.trim() == "..." { "...".to_owned() } else { "_".to_owned() }
176176
};
177177

178178
let param_len = param_text.len() + if param_parts.is_empty() { 0 } else { 2 };
179179
if total_len + param_len > max_param_len {
180-
param_parts.push("...".to_string());
180+
param_parts.push("...".to_owned());
181181
break;
182182
}
183183

@@ -186,12 +186,12 @@ fn format_function_hint(func: &ast::Fn, max_length: usize) -> Option<String> {
186186
}
187187

188188
if param_parts.is_empty() {
189-
"()".to_string()
189+
"()".to_owned()
190190
} else {
191191
format!("({})", param_parts.join(", "))
192192
}
193193
} else {
194-
"()".to_string()
194+
"()".to_owned()
195195
};
196196

197197
Some(format!("fn {}{}", name_str, params))

0 commit comments

Comments
 (0)