Skip to content

Commit 199ad93

Browse files
committed
Update rustfmt
1 parent 7f26ece commit 199ad93

File tree

6 files changed

+69
-206
lines changed

6 files changed

+69
-206
lines changed

src/context.rs

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ impl<'ctx> MessageContext<'ctx> {
7777
}
7878
}
7979

80-
8180
pub fn format<T: ResolveValue>(
8281
&self,
8382
resolvable: &T,

src/intl/mod.rs

+36-187
Original file line numberDiff line numberDiff line change
@@ -6,179 +6,20 @@ use self::fluent_locale::negotiate_languages;
66
use self::fluent_locale::NegotiationStrategy;
77

88
static LOCALES: &[&'static str] = &[
9-
"af",
10-
"ak",
11-
"am",
12-
"ar",
13-
"asa",
14-
"az",
15-
"be",
16-
"bem",
17-
"bez",
18-
"bg",
19-
"bh",
20-
"bm",
21-
"bn",
22-
"bo",
23-
"br",
24-
"brx",
25-
"bs",
26-
"ca",
27-
"cgg",
28-
"chr",
29-
"cs",
30-
"cy",
31-
"da",
32-
"de",
33-
"dv",
34-
"dz",
35-
"ee",
36-
"el",
37-
"en",
38-
"eo",
39-
"es",
40-
"et",
41-
"eu",
42-
"fa",
43-
"ff",
44-
"fi",
45-
"fil",
46-
"fo",
47-
"fr",
48-
"fur",
49-
"fy",
50-
"ga",
51-
"gd",
52-
"gl",
53-
"gsw",
54-
"gu",
55-
"guw",
56-
"gv",
57-
"ha",
58-
"haw",
59-
"he",
60-
"hi",
61-
"hr",
62-
"hu",
63-
"id",
64-
"ig",
65-
"ii",
66-
"is",
67-
"it",
68-
"iu",
69-
"ja",
70-
"jmc",
71-
"jv",
72-
"ka",
73-
"kab",
74-
"kaj",
75-
"kcg",
76-
"kde",
77-
"kea",
78-
"kk",
79-
"kl",
80-
"km",
81-
"kn",
82-
"ko",
83-
"ksb",
84-
"ksh",
85-
"ku",
86-
"kw",
87-
"lag",
88-
"lb",
89-
"lg",
90-
"ln",
91-
"lo",
92-
"lt",
93-
"lv",
94-
"mas",
95-
"mg",
96-
"mk",
97-
"ml",
98-
"mn",
99-
"mo",
100-
"mr",
101-
"ms",
102-
"mt",
103-
"my",
104-
"nah",
105-
"naq",
106-
"nb",
107-
"nd",
108-
"ne",
109-
"nl",
110-
"nn",
111-
"no",
112-
"nr",
113-
"nso",
114-
"ny",
115-
"nyn",
116-
"om",
117-
"or",
118-
"pa",
119-
"pap",
120-
"pl",
121-
"ps",
122-
"pt",
123-
"rm",
124-
"ro",
125-
"rof",
126-
"ru",
127-
"rwk",
128-
"sah",
129-
"saq",
130-
"se",
131-
"seh",
132-
"ses",
133-
"sg",
134-
"sh",
135-
"shi",
136-
"sk",
137-
"sl",
138-
"sma",
139-
"smi",
140-
"smj",
141-
"smn",
142-
"sms",
143-
"sn",
144-
"so",
145-
"sq",
146-
"sr",
147-
"ss",
148-
"ssy",
149-
"st",
150-
"sv",
151-
"sw",
152-
"syr",
153-
"ta",
154-
"te",
155-
"teo",
156-
"th",
157-
"ti",
158-
"tig",
159-
"tk",
160-
"tl",
161-
"tn",
162-
"to",
163-
"tr",
164-
"ts",
165-
"tzm",
166-
"uk",
167-
"ur",
168-
"ve",
169-
"vi",
170-
"vun",
171-
"wa",
172-
"wae",
173-
"wo",
174-
"xh",
175-
"xog",
176-
"yo",
177-
"zh",
178-
"zu",
9+
"af", "ak", "am", "ar", "asa", "az", "be", "bem", "bez", "bg", "bh", "bm", "bn", "bo", "br",
10+
"brx", "bs", "ca", "cgg", "chr", "cs", "cy", "da", "de", "dv", "dz", "ee", "el", "en", "eo",
11+
"es", "et", "eu", "fa", "ff", "fi", "fil", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw",
12+
"gu", "guw", "gv", "ha", "haw", "he", "hi", "hr", "hu", "id", "ig", "ii", "is", "it", "iu",
13+
"ja", "jmc", "jv", "ka", "kab", "kaj", "kcg", "kde", "kea", "kk", "kl", "km", "kn", "ko",
14+
"ksb", "ksh", "ku", "kw", "lag", "lb", "lg", "ln", "lo", "lt", "lv", "mas", "mg", "mk", "ml",
15+
"mn", "mo", "mr", "ms", "mt", "my", "nah", "naq", "nb", "nd", "ne", "nl", "nn", "no", "nr",
16+
"nso", "ny", "nyn", "om", "or", "pa", "pap", "pl", "ps", "pt", "rm", "ro", "rof", "ru", "rwk",
17+
"sah", "saq", "se", "seh", "ses", "sg", "sh", "shi", "sk", "sl", "sma", "smi", "smj", "smn",
18+
"sms", "sn", "so", "sq", "sr", "ss", "ssy", "st", "sv", "sw", "syr", "ta", "te", "teo", "th",
19+
"ti", "tig", "tk", "tl", "tn", "to", "tr", "ts", "tzm", "uk", "ur", "ve", "vi", "vun", "wa",
20+
"wae", "wo", "xh", "xog", "yo", "zh", "zu",
17921
];
18022

181-
18223
fn is_between(n: f32, start: f32, end: f32) -> bool {
18324
start <= n && n <= end
18425
}
@@ -225,16 +66,20 @@ static PLURAL_RULES: &[fn(f32) -> &'static str] = &[
22566
/* 3 */
22667
|n| if n == 1.0 { "one" } else { "other" },
22768
/* 4 */
228-
|n| if is_between(n, 0.0, 1.0) {
229-
"one"
230-
} else {
231-
"other"
69+
|n| {
70+
if is_between(n, 0.0, 1.0) {
71+
"one"
72+
} else {
73+
"other"
74+
}
23275
},
23376
/* 5 */
234-
|n| if is_between(n, 0.0, 2.0) {
235-
"one"
236-
} else {
237-
"other"
77+
|n| {
78+
if is_between(n, 0.0, 2.0) {
79+
"one"
80+
} else {
81+
"other"
82+
}
23883
},
23984
/* 6 */
24085
|n| {
@@ -357,10 +202,12 @@ static PLURAL_RULES: &[fn(f32) -> &'static str] = &[
357202
"other"
358203
},
359204
/* 16 */
360-
|n| if n % 10.0 == 1.0 && n != 11.0 {
361-
"one"
362-
} else {
363-
"other"
205+
|n| {
206+
if n % 10.0 == 1.0 && n != 11.0 {
207+
"one"
208+
} else {
209+
"other"
210+
}
364211
},
365212
/* 17 */
366213
|n| {
@@ -438,10 +285,12 @@ static PLURAL_RULES: &[fn(f32) -> &'static str] = &[
438285
"other"
439286
},
440287
/* 23 */
441-
|n| if is_between(n, 0.0, 1.0) || is_between(n, 11.0, 99.0) {
442-
"one"
443-
} else {
444-
"other"
288+
|n| {
289+
if is_between(n, 0.0, 1.0) || is_between(n, 11.0, 99.0) {
290+
"one"
291+
} else {
292+
"other"
293+
}
445294
},
446295
/* 24 */
447296
|n| {

src/syntax/ast.rs

+23-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ pub enum Entry {
1212
comment: Option<Comment>,
1313
},
1414
Comment(Comment),
15-
Junk { content: String },
15+
Junk {
16+
content: String,
17+
},
1618
}
1719

1820
#[derive(Debug, PartialEq)]
@@ -42,16 +44,30 @@ pub struct Placeable {
4244

4345
#[derive(Debug, PartialEq)]
4446
pub enum Expression {
45-
StringExpression { value: String },
46-
NumberExpression { value: Number },
47-
MessageReference { id: Identifier },
48-
ExternalArgument { id: Identifier },
47+
StringExpression {
48+
value: String,
49+
},
50+
NumberExpression {
51+
value: Number,
52+
},
53+
MessageReference {
54+
id: Identifier,
55+
},
56+
ExternalArgument {
57+
id: Identifier,
58+
},
4959
SelectExpression {
5060
expression: Option<Box<Expression>>,
5161
variants: Vec<Variant>,
5262
},
53-
AttributeExpression { id: Identifier, name: Identifier },
54-
VariantExpression { id: Identifier, key: VarKey },
63+
AttributeExpression {
64+
id: Identifier,
65+
name: Identifier,
66+
},
67+
VariantExpression {
68+
id: Identifier,
69+
key: VarKey,
70+
},
5571
CallExpression {
5672
callee: Function,
5773
args: Vec<Argument>,
@@ -99,7 +115,6 @@ pub struct Identifier {
99115
pub name: String,
100116
}
101117

102-
103118
#[derive(Debug, PartialEq)]
104119
pub struct Number {
105120
pub value: String,

src/syntax/errors/display.rs

-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub fn annotate_slice(info: &ErrorInfo, file_name: Option<String>, item: &Item)
4545
let lines_num = cmp::max(info.slice.lines().count(), 1);
4646
let max_ln_width = get_ln_width(info.line + lines_num);
4747

48-
4948
result += &format_title_line(item, id, &title);
5049
if let Some(name) = file_name {
5150
result += &format_pos_line(&name, info.line, info.col, max_ln_width);
@@ -129,7 +128,6 @@ fn format_slice(
129128
line_num += 1
130129
}
131130

132-
133131
result
134132
}
135133

src/syntax/errors/list.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ pub struct ErrorInfo {
1212
pub pos: usize,
1313
}
1414

15-
1615
#[derive(Debug, PartialEq)]
1716
pub enum ErrorKind {
1817
Generic,
1918
ExpectedEntry,
20-
ExpectedToken { token: char },
21-
ExpectedCharRange { range: String },
22-
ExpectedField { field: String },
19+
ExpectedToken {
20+
token: char,
21+
},
22+
ExpectedCharRange {
23+
range: String,
24+
},
25+
ExpectedField {
26+
field: String,
27+
},
2328
MissingField {
2429
entry_id: String,
2530
fields: Vec<&'static str>,
@@ -54,8 +59,7 @@ pub fn get_error_desc(err: &ErrorKind) -> (&'static str, String, &'static str) {
5459
"E0005",
5560
format!(
5661
"Expected entry `{}` to have one of the fields: {}",
57-
entry_id,
58-
list
62+
entry_id, list
5963
),
6064
"",
6165
)

src/syntax/parser.rs

-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ where
146146
})
147147
}
148148

149-
150149
fn get_message<I>(ps: &mut ParserStream<I>, comment: Option<ast::Comment>) -> Result<ast::Entry>
151150
where
152151
I: Iterator<Item = char>,
@@ -270,7 +269,6 @@ where
270269
Ok(ast::Identifier { name })
271270
}
272271

273-
274272
fn get_variant_key<I>(ps: &mut ParserStream<I>) -> Result<ast::VarKey>
275273
where
276274
I: Iterator<Item = char>,

0 commit comments

Comments
 (0)