Skip to content

Commit 14ae393

Browse files
authored
Rollup 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 5e1ed57 + fd05fa0 commit 14ae393

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
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

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)