Skip to content

Commit d0ea1d7

Browse files
committed
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
tidy: check fluent files for style Inspired by #100651 (comment) There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.
2 parents 3ce46b7 + 2954571 commit d0ea1d7

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

compiler/rustc_error_messages/locales/en-US/borrowck.ftl

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ borrowck_could_not_normalize =
1313
1414
borrowck_higher_ranked_subtype_error =
1515
higher-ranked subtype error
16-
17-
generic_does_not_live_long_enough =
18-
`{$kind}` does not live long enough
16+
17+
borrowck_generic_does_not_live_long_enough =
18+
`{$kind}` does not live long enough

compiler/rustc_error_messages/locales/en-US/expand.ftl

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ expand_explain_doc_comment_outer =
44
expand_explain_doc_comment_inner =
55
inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
66
7-
expand_expr_repeat_no_syntax_vars =
7+
expand_expr_repeat_no_syntax_vars =
88
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
99
10-
expand_must_repeat_once =
10+
expand_must_repeat_once =
1111
this must repeat at least once
1212
1313
expand_count_repetition_misplaced =
@@ -19,4 +19,4 @@ expand_meta_var_expr_unrecognized_var =
1919
expand_var_still_repeating =
2020
variable '{$ident}' is still repeating at this depth
2121
22-
expand_meta_var_dif_seq_matchers = {$msg}
22+
expand_meta_var_dif_seq_matchers = {$msg}

src/tools/tidy/src/style.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,13 @@ fn should_ignore(line: &str) -> bool {
125125

126126
/// Returns `true` if `line` is allowed to be longer than the normal limit.
127127
fn long_line_is_ok(extension: &str, is_error_code: bool, max_columns: usize, line: &str) -> bool {
128-
if extension != "md" || is_error_code {
129-
if line_is_url(is_error_code, max_columns, line) || should_ignore(line) {
130-
return true;
131-
}
132-
} else if extension == "md" {
128+
match extension {
129+
// fluent files are allowed to be any length
130+
"ftl" => true,
133131
// non-error code markdown is allowed to be any length
134-
return true;
132+
"md" if !is_error_code => true,
133+
_ => line_is_url(is_error_code, max_columns, line) || should_ignore(line),
135134
}
136-
137-
false
138135
}
139136

140137
enum Directive {
@@ -230,7 +227,7 @@ pub fn check(path: &Path, bad: &mut bool) {
230227
super::walk(path, &mut skip, &mut |entry, contents| {
231228
let file = entry.path();
232229
let filename = file.file_name().unwrap().to_string_lossy();
233-
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css"];
230+
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css", ".ftl"];
234231
if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") {
235232
return;
236233
}

0 commit comments

Comments
 (0)