Skip to content

fix(hover): unify horizontal rule formatting to --- #20379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/ide/src/hover/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ pub(super) fn try_for_lint(attr: &ast::Attr, token: &SyntaxToken) -> Option<Hove
let lint =
lints.binary_search_by_key(&needle, |lint| lint.label).ok().map(|idx| &lints[idx])?;
Some(HoverResult {
markup: Markup::from(format!("```\n{}\n```\n___\n\n{}", lint.label, lint.description)),
markup: Markup::from(format!("```\n{}\n```\n---\n\n{}", lint.label, lint.description)),
..Default::default()
})
}
Expand Down Expand Up @@ -912,7 +912,7 @@ pub(super) fn literal(
};
let ty = ty.display(sema.db, display_target);

let mut s = format!("```rust\n{ty}\n```\n___\n\n");
let mut s = format!("```rust\n{ty}\n```\n---\n\n");
match value {
Ok(value) => {
let backtick_len = value.chars().filter(|c| *c == '`').count();
Expand Down Expand Up @@ -1026,7 +1026,7 @@ fn type_info(
if let Some(extra) =
render_notable_trait(db, &notable_traits(db, &original), edition, display_target)
{
desc.push_str("\n___\n");
desc.push_str("\n---\n");
desc.push_str(&extra);
};
desc.into()
Expand Down Expand Up @@ -1094,7 +1094,7 @@ fn closure_ty(
|_| None,
|_| None,
) {
format_to!(markup, "\n___\n{layout}");
format_to!(markup, "\n---\n{layout}");
}
format_to!(markup, "{adjusted}\n\n## Captures\n{}", captures_rendered,);

Expand Down
76 changes: 38 additions & 38 deletions crates/ide/src/hover/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ fn main() {
```rust
impl Fn(i32) -> i32
```
___
---
size = 8, align = 8, niches = 1

## Captures
Expand All @@ -380,7 +380,7 @@ fn main() {
```rust
impl Fn(i32) -> i32
```
___
---
size = 0, align = 1

## Captures
Expand Down Expand Up @@ -414,7 +414,7 @@ fn main() {
```rust
impl FnOnce()
```
___
---
size = 16 (0x10), align = 8, niches = 1

## Captures
Expand Down Expand Up @@ -443,7 +443,7 @@ fn main() {
```rust
impl FnMut()
```
___
---
size = 8, align = 8, niches = 1

## Captures
Expand All @@ -468,7 +468,7 @@ fn main() {
```rust
impl FnOnce() -> S2
```
___
---
size = 8, align = 8, niches = 1
Coerced to: &impl FnOnce() -> S2

Expand Down Expand Up @@ -6829,7 +6829,7 @@ fn hover_lint() {
```
arithmetic_overflow
```
___
---

arithmetic operation overflows
"#]],
Expand All @@ -6841,7 +6841,7 @@ fn hover_lint() {
```
arithmetic_overflow
```
___
---

arithmetic operation overflows
"#]],
Expand All @@ -6857,7 +6857,7 @@ fn hover_clippy_lint() {
```
clippy::almost_swapped
```
___
---

Checks for `foo = bar; bar = foo` sequences.
"#]],
Expand All @@ -6869,7 +6869,7 @@ fn hover_clippy_lint() {
```
clippy::almost_swapped
```
___
---

Checks for `foo = bar; bar = foo` sequences.
"#]],
Expand Down Expand Up @@ -8567,7 +8567,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: ` 🦀🦀\A `
"#]],
Expand All @@ -8583,7 +8583,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: ` 🦀\u{1f980}\\\x41 `
"#]],
Expand All @@ -8605,7 +8605,7 @@ fsdghs";
```rust
&'static str
```
___
---

value of literal (truncated up to newline): ` 🦀\u{1f980}\\\x41 `
"#]],
Expand All @@ -8625,7 +8625,7 @@ fn main() {
```rust
&'static {unknown}
```
___
---

value of literal: ` 🦀🦀\A `
"#]],
Expand All @@ -8644,7 +8644,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: ```` `[^`]*` ````
"#]],
Expand All @@ -8659,7 +8659,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: `` ` ``
"#]],
Expand All @@ -8674,7 +8674,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: ` `
"#]],
Expand All @@ -8690,7 +8690,7 @@ fn main() {
```rust
&'static str
```
___
---

value of literal: ` Hello World `
"#]],
Expand All @@ -8710,7 +8710,7 @@ fn main() {
```rust
&'static [u8; 5]
```
___
---

value of literal: ` [240, 159, 166, 128, 92] `
"#]],
Expand All @@ -8726,7 +8726,7 @@ fn main() {
```rust
&'static [u8; 18]
```
___
---

value of literal: ` [92, 120, 70, 48, 92, 120, 57, 70, 92, 120, 65, 54, 92, 120, 56, 48, 92, 92] `
"#]],
Expand All @@ -8746,7 +8746,7 @@ fn main() {
```rust
u8
```
___
---

value of literal: ` 0xF0 `
"#]],
Expand All @@ -8762,7 +8762,7 @@ fn main() {
```rust
u8
```
___
---

value of literal: ` 0x5C `
"#]],
Expand All @@ -8782,7 +8782,7 @@ fn main() {
```rust
char
```
___
---

value of literal: ` A `
"#]],
Expand All @@ -8798,7 +8798,7 @@ fn main() {
```rust
char
```
___
---

value of literal: ` \ `
"#]],
Expand All @@ -8814,7 +8814,7 @@ fn main() {
```rust
char
```
___
---

value of literal: ` 🦀 `
"#]],
Expand All @@ -8834,7 +8834,7 @@ fn main() {
```rust
f64
```
___
---

value of literal: ` 1 (bits: 0x3FF0000000000000) `
"#]],
Expand All @@ -8850,7 +8850,7 @@ fn main() {
```rust
f16
```
___
---

value of literal: ` 1 (bits: 0x3C00) `
"#]],
Expand All @@ -8866,7 +8866,7 @@ fn main() {
```rust
f32
```
___
---

value of literal: ` 1 (bits: 0x3F800000) `
"#]],
Expand All @@ -8882,7 +8882,7 @@ fn main() {
```rust
f128
```
___
---

value of literal: ` 1 (bits: 0x3FFF0000000000000000000000000000) `
"#]],
Expand All @@ -8898,7 +8898,7 @@ fn main() {
```rust
f64
```
___
---

value of literal: ` 134000000000000 (bits: 0x42DE77D399980000) `
"#]],
Expand All @@ -8914,7 +8914,7 @@ fn main() {
```rust
f64
```
___
---

value of literal: ` 1523527134274733600000000 (bits: 0x44F429E9249F629B) `
"#]],
Expand All @@ -8930,7 +8930,7 @@ fn main() {
```rust
f64
```
___
---

invalid literal: invalid float literal
"#]],
Expand All @@ -8950,7 +8950,7 @@ fn main() {
```rust
i32
```
___
---

value of literal: ` 34325236457856836345234 (0x744C659178614489D92|0b111010001001100011001011001000101111000011000010100010010001001110110010010) `
"#]],
Expand All @@ -8966,7 +8966,7 @@ fn main() {
```rust
i32
```
___
---

value of literal: ` 13412342421 (0x31F701A95|0b1100011111011100000001101010010101) `
"#]],
Expand All @@ -8982,7 +8982,7 @@ fn main() {
```rust
i32
```
___
---

value of literal: ` 306328611 (0x12423423|0b10010010000100011010000100011) `
"#]],
Expand All @@ -8998,7 +8998,7 @@ fn main() {
```rust
i32
```
___
---

value of literal: ` 255 (0xFF|0b11111111) `
"#]],
Expand All @@ -9014,7 +9014,7 @@ fn main() {
```rust
i32
```
___
---

value of literal: ` 5349 (0x14E5|0b1010011100101) `
"#]],
Expand All @@ -9030,7 +9030,7 @@ fn main() {
```rust
i32
```
___
---

invalid literal: number too large to fit in target type
"#]],
Expand Down Expand Up @@ -9186,7 +9186,7 @@ fn main() {
```rust
S
```
___
---
Implements notable traits: `Future<Output = u32>`, `Iterator<Item = S>`, `Notable`"#]],
);
}
Expand Down
Loading