Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9f52ca2

Browse files
authored
Merge pull request#327 from Muscraft/use-straight-arrows
fix: Use straight arrows for standalone Origin
2 parents0bae5bd +331e11f commit9f52ca2

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

‎src/renderer/mod.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,10 @@ impl DecorStyle {
297297
}
298298
}
299299

300-
fnfile_start(&self,is_first:bool) ->&'staticstr{
300+
fnfile_start(&self,is_first:bool,alone:bool) ->&'staticstr{
301301
matchself{
302302
DecorStyle::Ascii =>"--> ",
303+
DecorStyle::Unicodeif is_first && alone =>" ─▸ ",
303304
DecorStyle::Unicodeif is_first =>" ╭▸ ",
304305
DecorStyle::Unicode =>" ├▸ ",
305306
}

‎src/renderer/render.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ pub(crate) fn render(renderer: &Renderer, groups: Report<'_>) -> String {
186186
origin,
187187
is_primary,
188188
is_first,
189+
peek.is_none(),
189190
buffer_msg_line_offset,
190191
);
191192
let current_line = buffer.num_lines();
@@ -286,7 +287,7 @@ fn render_short_message(renderer: &Renderer, groups: &[Group<'_>]) -> Result<Str
286287
}
287288
}
288289

289-
render_origin(renderer,&mut buffer,0,&origin,true,true,0);
290+
render_origin(renderer,&mut buffer,0,&origin,true,true,true,0);
290291
buffer.append(0,": ",ElementStyle::LineAndColumn);
291292
}
292293
}
@@ -432,19 +433,21 @@ fn render_title(
432433
}
433434
}
434435

436+
#[allow(clippy::too_many_arguments)]
435437
fnrender_origin(
436438
renderer:&Renderer,
437439
buffer:&mutStyledBuffer,
438440
max_line_num_len:usize,
439441
origin:&Origin<'_>,
440442
is_primary:bool,
441443
is_first:bool,
444+
alone:bool,
442445
buffer_msg_line_offset:usize,
443446
){
444447
if is_primary && !renderer.short_message{
445448
buffer.prepend(
446449
buffer_msg_line_offset,
447-
renderer.decor_style.file_start(is_first),
450+
renderer.decor_style.file_start(is_first, alone),
448451
ElementStyle::LineNumber,
449452
);
450453
}elseif !renderer.short_message{
@@ -558,6 +561,7 @@ fn render_snippet_annotations(
558561
&origin,
559562
is_primary,
560563
is_first,
564+
false,
561565
buffer_msg_line_offset,
562566
);
563567
// Put in the spacer between the location and annotated source
@@ -574,7 +578,7 @@ fn render_snippet_annotations(
574578
buffer.puts(
575579
buffer_msg_line_offset,
576580
max_line_num_len,
577-
renderer.decor_style.file_start(is_first),
581+
renderer.decor_style.file_start(is_first,false),
578582
ElementStyle::LineNumber,
579583
);
580584
}else{
@@ -1462,7 +1466,7 @@ fn emit_suggestion_default(
14621466
let(loc, _) = sm.span_to_locations(parts[0].span.clone());
14631467
// --> file.rs:line:col
14641468
// |
1465-
let arrow = renderer.decor_style.file_start(is_first);
1469+
let arrow = renderer.decor_style.file_start(is_first,false);
14661470
buffer.puts(row_num -1,0, arrow,ElementStyle::LineNumber);
14671471
let message =format!("{}:{}:{}", path, loc.line, loc.char +1);
14681472
let col = usize::max(max_line_num_len +1, arrow.len());

‎tests/color/multiline_removal_suggestion.unicode.term.svg‎

Lines changed: 1 addition & 1 deletion
Loading

‎tests/rustc_tests.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,8 +4189,8 @@ LL │ let _ = quote! { $($ip)* }; //~ ERROR the method `quote_into_iter` ex
41894189
`&mut Ipv4Addr: Iterator`
41904190
which is required by `&mut Ipv4Addr: proc_macro::ext::RepIteratorExt`
41914191
note: the traits `Iterator` and `ToTokens` must be implemented
4192-
▸ $SRC_DIR/proc_macro/src/to_tokens.rs:11:0
4193-
▸ $SRC_DIR/core/src/iter/traits/iterator.rs:39:0
4192+
▸ $SRC_DIR/proc_macro/src/to_tokens.rs:11:0
4193+
▸ $SRC_DIR/core/src/iter/traits/iterator.rs:39:0
41944194
"#]];
41954195
let renderer = renderer.decor_style(DecorStyle::Unicode);
41964196
assert_data_eq!(renderer.render(input), expected_unicode);
@@ -4513,7 +4513,7 @@ LL │ ┃ }
45134513
45144514
╰ note: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types
45154515
note: `core::alloc::Layout` is defined in crate `core`
4516-
▸ $SRC_DIR/core/src/alloc/layout.rs:40:0
4516+
▸ $SRC_DIR/core/src/alloc/layout.rs:40:0
45174517
note: `Layout` is defined in the current crate
45184518
╭▸ $DIR/alloc-error-handler-bad-signature-2.rs:7:1
45194519

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp