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

Commit9c43a84

Browse files
committed
chore: Update lints from epage/_rust template
1 parentb5a6b53 commit9c43a84

File tree

6 files changed

+108
-44
lines changed

6 files changed

+108
-44
lines changed

‎Cargo.toml‎

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,68 @@ default = []
5050
testing-colors = []
5151

5252
[lints.rust]
53-
rust_2018_idioms ="warn"
53+
rust_2018_idioms = {level ="warn",priority =-1 }
54+
unreachable_pub ="warn"
55+
unsafe_op_in_unsafe_fn ="warn"
56+
unused_lifetimes ="warn"
57+
unused_macro_rules ="warn"
58+
unused_qualifications ="warn"
59+
60+
[lints.clippy]
61+
bool_assert_comparison ="allow"
62+
branches_sharing_code ="allow"
63+
checked_conversions ="warn"
64+
collapsible_else_if ="allow"
65+
create_dir ="warn"
66+
dbg_macro ="warn"
67+
debug_assert_with_mut_call ="warn"
68+
doc_markdown ="warn"
69+
empty_enum ="warn"
70+
enum_glob_use ="warn"
71+
expl_impl_clone_on_copy ="warn"
72+
explicit_deref_methods ="warn"
73+
explicit_into_iter_loop ="warn"
74+
fallible_impl_from ="warn"
75+
filter_map_next ="warn"
76+
flat_map_option ="warn"
77+
float_cmp_const ="warn"
78+
fn_params_excessive_bools ="warn"
79+
from_iter_instead_of_collect ="warn"
80+
if_same_then_else ="allow"
81+
implicit_clone ="warn"
82+
imprecise_flops ="warn"
83+
inconsistent_struct_constructor ="warn"
84+
inefficient_to_string ="warn"
85+
infinite_loop ="warn"
86+
invalid_upcast_comparisons ="warn"
87+
large_digit_groups ="warn"
88+
large_stack_arrays ="warn"
89+
large_types_passed_by_value ="warn"
90+
let_and_return ="allow"# sometimes good to name what you are returning
91+
linkedlist ="warn"
92+
lossy_float_literal ="warn"
93+
macro_use_imports ="warn"
94+
mem_forget ="warn"
95+
mutex_integer ="warn"
96+
needless_continue ="warn"
97+
needless_for_each ="warn"
98+
negative_feature_names ="warn"
99+
path_buf_push_overwrite ="warn"
100+
ptr_as_ptr ="warn"
101+
rc_mutex ="warn"
102+
redundant_feature_names ="warn"
103+
ref_option_ref ="warn"
104+
rest_pat_in_fully_bound_structs ="warn"
105+
same_functions_in_if_condition ="warn"
106+
self_named_module_files ="warn"
107+
semicolon_if_nothing_returned ="warn"
108+
str_to_string ="warn"
109+
string_add ="warn"
110+
string_add_assign ="warn"
111+
string_lit_as_bytes ="warn"
112+
string_to_string ="warn"
113+
todo ="warn"
114+
trait_duplication_in_bounds ="warn"
115+
verbose_file_reads ="warn"
116+
wildcard_imports ="warn"
117+
zero_sized_map_values ="warn"

‎benches/simple.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn create_snippet(renderer: Renderer) {
5050

5151
pubfncriterion_benchmark(c:&mutCriterion){
5252
c.bench_function("format", |b|{
53-
b.iter(||black_box(create_snippet(Renderer::plain())))
53+
b.iter(||black_box(create_snippet(Renderer::plain())));
5454
});
5555
}
5656

‎src/renderer/display_list.rs‎

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! display_list module stores the output model for the snippet.
1+
//!`display_list` module stores the output model for the snippet.
22
//!
33
//! `DisplayList` is a central structure in the crate, which contains
44
//! the structured list of lines to be displayed.
@@ -48,9 +48,9 @@ const WARNING_TXT: &str = "warning";
4848

4949
/// List of lines to be displayed.
5050
pub(crate)structDisplayList<'a>{
51-
pubbody:Vec<DisplaySet<'a>>,
52-
pubstylesheet:&'aStylesheet,
53-
pubanonymized_line_numbers:bool,
51+
pub(crate)body:Vec<DisplaySet<'a>>,
52+
pub(crate)stylesheet:&'aStylesheet,
53+
pub(crate)anonymized_line_numbers:bool,
5454
}
5555

5656
impl<'a>PartialEqforDisplayList<'a>{
@@ -147,8 +147,8 @@ impl<'a> DisplayList<'a> {
147147

148148
#[derive(Debug,PartialEq)]
149149
pub(crate)structDisplaySet<'a>{
150-
pubdisplay_lines:Vec<DisplayLine<'a>>,
151-
pubmargin:Margin,
150+
pub(crate)display_lines:Vec<DisplayLine<'a>>,
151+
pub(crate)margin:Margin,
152152
}
153153

154154
impl<'a>DisplaySet<'a>{
@@ -493,15 +493,15 @@ impl<'a> DisplaySet<'a> {
493493

494494
/// Inline annotation which can be used in either Raw or Source line.
495495
#[derive(Debug,PartialEq)]
496-
pubstructAnnotation<'a>{
497-
pubannotation_type:DisplayAnnotationType,
498-
pubid:Option<&'astr>,
499-
publabel:Vec<DisplayTextFragment<'a>>,
496+
pub(crate)structAnnotation<'a>{
497+
pub(crate)annotation_type:DisplayAnnotationType,
498+
pub(crate)id:Option<&'astr>,
499+
pub(crate)label:Vec<DisplayTextFragment<'a>>,
500500
}
501501

502502
/// A single line used in `DisplayList`.
503503
#[derive(Debug,PartialEq)]
504-
pubenumDisplayLine<'a>{
504+
pub(crate)enumDisplayLine<'a>{
505505
/// A line with `lineno` portion of the slice.
506506
Source{
507507
lineno:Option<usize>,
@@ -519,7 +519,7 @@ pub enum DisplayLine<'a> {
519519

520520
/// A source line.
521521
#[derive(Debug,PartialEq)]
522-
pubenumDisplaySourceLine<'a>{
522+
pub(crate)enumDisplaySourceLine<'a>{
523523
/// A line with the content of the Snippet.
524524
Content{
525525
text:&'astr,
@@ -530,17 +530,17 @@ pub enum DisplaySourceLine<'a> {
530530
}
531531

532532
#[derive(Debug,PartialEq)]
533-
pubstructDisplaySourceAnnotation<'a>{
534-
pubannotation:Annotation<'a>,
535-
pubrange:(usize,usize),
536-
pubannotation_type:DisplayAnnotationType,
537-
pubannotation_part:DisplayAnnotationPart,
533+
pub(crate)structDisplaySourceAnnotation<'a>{
534+
pub(crate)annotation:Annotation<'a>,
535+
pub(crate)range:(usize,usize),
536+
pub(crate)annotation_type:DisplayAnnotationType,
537+
pub(crate)annotation_part:DisplayAnnotationPart,
538538
}
539539

540540
/// Raw line - a line which does not have the `lineno` part and is not considered
541541
/// a part of the snippet.
542542
#[derive(Debug,PartialEq)]
543-
pubenumDisplayRawLine<'a>{
543+
pub(crate)enumDisplayRawLine<'a>{
544544
/// A line which provides information about the location of the given
545545
/// slice in the project structure.
546546
Origin{
@@ -566,23 +566,23 @@ pub enum DisplayRawLine<'a> {
566566

567567
/// An inline text fragment which any label is composed of.
568568
#[derive(Debug,PartialEq)]
569-
pubstructDisplayTextFragment<'a>{
570-
pubcontent:&'astr,
571-
pubstyle:DisplayTextStyle,
569+
pub(crate)structDisplayTextFragment<'a>{
570+
pub(crate)content:&'astr,
571+
pub(crate)style:DisplayTextStyle,
572572
}
573573

574574
/// A style for the `DisplayTextFragment` which can be visually formatted.
575575
///
576576
/// This information may be used to emphasis parts of the label.
577577
#[derive(Debug,Clone,Copy,PartialEq)]
578-
pubenumDisplayTextStyle{
578+
pub(crate)enumDisplayTextStyle{
579579
Regular,
580580
Emphasis,
581581
}
582582

583583
/// An indicator of what part of the annotation a given `Annotation` is.
584584
#[derive(Debug,Clone,PartialEq)]
585-
pubenumDisplayAnnotationPart{
585+
pub(crate)enumDisplayAnnotationPart{
586586
/// A standalone, single-line annotation.
587587
Standalone,
588588
/// A continuation of a multi-line label of an annotation.
@@ -595,14 +595,14 @@ pub enum DisplayAnnotationPart {
595595

596596
/// A visual mark used in `inline_marks` field of the `DisplaySourceLine`.
597597
#[derive(Debug,Clone,PartialEq)]
598-
pubstructDisplayMark{
599-
pubmark_type:DisplayMarkType,
600-
pubannotation_type:DisplayAnnotationType,
598+
pub(crate)structDisplayMark{
599+
pub(crate)mark_type:DisplayMarkType,
600+
pub(crate)annotation_type:DisplayAnnotationType,
601601
}
602602

603603
/// A type of the `DisplayMark`.
604604
#[derive(Debug,Clone,PartialEq)]
605-
pubenumDisplayMarkType{
605+
pub(crate)enumDisplayMarkType{
606606
/// A mark indicating a multiline annotation going through the current line.
607607
AnnotationThrough,
608608
/// A mark indicating a multiline annotation starting on the given line.
@@ -617,7 +617,7 @@ pub enum DisplayMarkType {
617617
/// * An underline for `Error` may be `^^^` while for `Warning` it could be `---`.
618618
/// * `ColorStylesheet` may use different colors for different annotations.
619619
#[derive(Debug,Clone,PartialEq)]
620-
pubenumDisplayAnnotationType{
620+
pub(crate)enumDisplayAnnotationType{
621621
None,
622622
Error,
623623
Warning,
@@ -642,7 +642,7 @@ impl From<snippet::Level> for DisplayAnnotationType {
642642
/// for multi-slice cases.
643643
// TODO: private
644644
#[derive(Debug,Clone,PartialEq)]
645-
pubenumDisplayHeaderType{
645+
pub(crate)enumDisplayHeaderType{
646646
/// Initial header is the first header in the snippet.
647647
Initial,
648648

@@ -728,9 +728,9 @@ fn format_message(
728728
}
729729

730730
ifletSome(first) = sets.first_mut(){
731-
body.into_iter().for_each(|line|{
731+
forlinein body{
732732
first.display_lines.insert(0, line);
733-
});
733+
}
734734
}else{
735735
sets.push(DisplaySet{
736736
display_lines: body,
@@ -1335,7 +1335,7 @@ const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[
13351335
];
13361336

13371337
fnnormalize_whitespace(str:&str) ->String{
1338-
letmut s = str.to_string();
1338+
letmut s = str.to_owned();
13391339
for(c, replacement)inOUTPUT_REPLACEMENTS{
13401340
s = s.replace(*c, replacement);
13411341
}

‎src/renderer/margin.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const LONG_WHITESPACE: usize = 20;
55
constLONG_WHITESPACE_PADDING:usize =4;
66

77
#[derive(Clone,Copy,Debug,PartialEq)]
8-
pubstructMargin{
8+
pub(crate)structMargin{
99
/// The available whitespace in the left that can be consumed when centering.
1010
whitespace_left:usize,
1111
/// The column of the beginning of left-most span.
@@ -24,7 +24,7 @@ pub struct Margin {
2424
}
2525

2626
implMargin{
27-
pubfnnew(
27+
pub(crate)fnnew(
2828
whitespace_left:usize,
2929
span_left:usize,
3030
span_right:usize,

‎tests/fixtures/deserialize.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use annotate_snippets::renderer::DEFAULT_TERM_WIDTH;
55
use annotate_snippets::{Annotation,Level,Message,Renderer,Snippet};
66

77
#[derive(Deserialize)]
8-
pubstructFixture<'a>{
8+
pub(crate)structFixture<'a>{
99
#[serde(default)]
10-
pubrenderer:RendererDef,
10+
pub(crate)renderer:RendererDef,
1111
#[serde(borrow)]
12-
pubmessage:MessageDef<'a>,
12+
pub(crate)message:MessageDef<'a>,
1313
}
1414

1515
#[derive(Deserialize)]
@@ -88,7 +88,7 @@ impl<'a> From<SnippetDef<'a>> for Snippet<'a> {
8888
} = val;
8989
letmut snippet =Snippet::source(source).line_start(line_start).fold(fold);
9090
ifletSome(origin) = origin{
91-
snippet = snippet.origin(origin)
91+
snippet = snippet.origin(origin);
9292
}
9393
snippet = snippet.annotations(annotations);
9494
snippet
@@ -127,11 +127,11 @@ impl<'a> From<AnnotationDef<'a>> for Annotation<'a> {
127127
}
128128

129129
#[derive(Serialize,Deserialize)]
130-
pubstructLabelDef<'a>{
130+
pub(crate)structLabelDef<'a>{
131131
#[serde(with ="LevelDef")]
132-
publevel:Level,
132+
pub(crate)level:Level,
133133
#[serde(borrow)]
134-
publabel:&'astr,
134+
pub(crate)label:&'astr,
135135
}
136136

137137
#[allow(dead_code)]

‎tests/fixtures/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515

1616
fnsetup(input_path: std::path::PathBuf) -> tryfn::Case{
1717
let name = input_path.file_name().unwrap().to_str().unwrap().to_owned();
18-
let expected =tryfn::Data::read_from(&input_path.with_extension("svg"),None);
18+
let expected =Data::read_from(&input_path.with_extension("svg"),None);
1919
tryfn::Case{
2020
name,
2121
fixture: input_path,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp