about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-22 03:02:50 +0000
committerbors <bors@rust-lang.org>2022-08-22 03:02:50 +0000
commitd0ea1d767925d53b2230e2ba81197821514781f0 (patch)
tree00c8c6d8dfc3b486297969abb3a3427a8f9889aa
parent3ce46b74aa3968b459cff3ce5c0d4f13e220b217 (diff)
parent295457192d100b62fa2c6148ad6b98b2b619937d (diff)
downloadrust-d0ea1d767925d53b2230e2ba81197821514781f0.tar.gz
rust-d0ea1d767925d53b2230e2ba81197821514781f0.zip
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
tidy: check fluent files for style

Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576

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.
-rw-r--r--compiler/rustc_error_messages/locales/en-US/borrowck.ftl6
-rw-r--r--compiler/rustc_error_messages/locales/en-US/expand.ftl6
-rw-r--r--src/tools/tidy/src/style.rs15
3 files changed, 12 insertions, 15 deletions
diff --git a/compiler/rustc_error_messages/locales/en-US/borrowck.ftl b/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
index 4af40d2062d..a96fe7c8a05 100644
--- a/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/borrowck.ftl
@@ -13,6 +13,6 @@ borrowck_could_not_normalize =
 
 borrowck_higher_ranked_subtype_error =
     higher-ranked subtype error
-  
-generic_does_not_live_long_enough =
-    `{$kind}` does not live long enough
\ No newline at end of file
+
+borrowck_generic_does_not_live_long_enough =
+    `{$kind}` does not live long enough
diff --git a/compiler/rustc_error_messages/locales/en-US/expand.ftl b/compiler/rustc_error_messages/locales/en-US/expand.ftl
index ee76a4f4500..5720591154f 100644
--- a/compiler/rustc_error_messages/locales/en-US/expand.ftl
+++ b/compiler/rustc_error_messages/locales/en-US/expand.ftl
@@ -4,10 +4,10 @@ expand_explain_doc_comment_outer =
 expand_explain_doc_comment_inner =
     inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
 
-expand_expr_repeat_no_syntax_vars = 
+expand_expr_repeat_no_syntax_vars =
     attempted to repeat an expression containing no syntax variables matched as repeating at this depth
 
-expand_must_repeat_once = 
+expand_must_repeat_once =
     this must repeat at least once
 
 expand_count_repetition_misplaced =
@@ -19,4 +19,4 @@ expand_meta_var_expr_unrecognized_var =
 expand_var_still_repeating =
     variable '{$ident}' is still repeating at this depth
 
-expand_meta_var_dif_seq_matchers = {$msg}
\ No newline at end of file
+expand_meta_var_dif_seq_matchers = {$msg}
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index 3cf44a2d7d1..dee58ff2fb5 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -125,16 +125,13 @@ fn should_ignore(line: &str) -> bool {
 
 /// Returns `true` if `line` is allowed to be longer than the normal limit.
 fn long_line_is_ok(extension: &str, is_error_code: bool, max_columns: usize, line: &str) -> bool {
-    if extension != "md" || is_error_code {
-        if line_is_url(is_error_code, max_columns, line) || should_ignore(line) {
-            return true;
-        }
-    } else if extension == "md" {
+    match extension {
+        // fluent files are allowed to be any length
+        "ftl" => true,
         // non-error code markdown is allowed to be any length
-        return true;
+        "md" if !is_error_code => true,
+        _ => line_is_url(is_error_code, max_columns, line) || should_ignore(line),
     }
-
-    false
 }
 
 enum Directive {
@@ -230,7 +227,7 @@ pub fn check(path: &Path, bad: &mut bool) {
     super::walk(path, &mut skip, &mut |entry, contents| {
         let file = entry.path();
         let filename = file.file_name().unwrap().to_string_lossy();
-        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css"];
+        let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css", ".ftl"];
         if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") {
             return;
         }