Skip to content

Commit b9a3371

Browse files
author
Zibi Braniecki
committed
cargo fmt
1 parent dabc1af commit b9a3371

File tree

10 files changed

+39
-27
lines changed

10 files changed

+39
-27
lines changed

fluent-syntax/src/parser/parser.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,19 @@ where
639639
'0'...'9' => ast::Expression::NumberExpression {
640640
value: get_number(ps)?,
641641
},
642-
'-' => if let Some('0'...'9') = ps.peek() {
643-
ps.reset_peek(None);
644-
ast::Expression::NumberExpression {
645-
value: get_number(ps)?,
646-
}
647-
} else {
648-
ps.reset_peek(None);
649-
ast::Expression::MessageReference {
650-
id: get_entry_identifier(ps)?,
642+
'-' => {
643+
if let Some('0'...'9') = ps.peek() {
644+
ps.reset_peek(None);
645+
ast::Expression::NumberExpression {
646+
value: get_number(ps)?,
647+
}
648+
} else {
649+
ps.reset_peek(None);
650+
ast::Expression::MessageReference {
651+
id: get_entry_identifier(ps)?,
652+
}
651653
}
652-
},
654+
}
653655
'"' => ast::Expression::StringExpression {
654656
value: get_string(ps)?,
655657
},

fluent/examples/external_arguments.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ unread-emails =
1717
*[other] You have { $emailCount } unread emails
1818
}
1919
",
20-
).unwrap();
20+
)
21+
.unwrap();
2122

2223
let mut args = HashMap::new();
2324
args.insert("name", FluentValue::from("John"));

fluent/examples/functions.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ fn main() {
1010
bundle
1111
.add_function("HELLO", |_args, _named_args| {
1212
return Some("I'm a function!".into());
13-
}).unwrap();
13+
})
14+
.unwrap();
1415

1516
// Test for a function that accepts unnamed positional arguments
1617
bundle
@@ -22,7 +23,8 @@ fn main() {
2223
}
2324

2425
None
25-
}).unwrap();
26+
})
27+
.unwrap();
2628

2729
// Test for a function that accepts named arguments
2830
bundle
@@ -35,7 +37,8 @@ fn main() {
3537
}
3638
_ => None,
3739
};
38-
}).unwrap();
40+
})
41+
.unwrap();
3942

4043
bundle
4144
.add_messages("hello-world = Hey there! { HELLO() }")

fluent/examples/message_reference.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ foo = Foo
1111
foobar = { foo } Bar
1212
bazbar = { baz } Bar
1313
",
14-
).unwrap();
14+
)
15+
.unwrap();
1516

1617
match bundle.format("foobar", None) {
1718
Some((value, _)) => println!("{}", value),

fluent/examples/selector.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ hello-world2 = Hello { $name ->
1919
[moon] Moon
2020
}
2121
",
22-
).unwrap();
22+
)
23+
.unwrap();
2324

2425
match bundle.format("hello-world", None) {
2526
Some((value, _)) => println!("{}", value),

fluent/src/bin/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ fn main() {
3030
.args_from_usage(
3131
"-s, --silence 'disable output'
3232
<INPUT> 'Sets the input file to use'",
33-
).get_matches();
33+
)
34+
.get_matches();
3435

3536
let input = matches.value_of("INPUT").unwrap();
3637

fluent/src/bundle.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ impl<'bundle> FluentBundle<'bundle> {
6666
IntlPluralRules::get_locales(PluralRuleType::CARDINAL),
6767
Some("en"),
6868
&NegotiationStrategy::Lookup,
69-
)[0].to_owned();
69+
)[0]
70+
.to_owned();
7071

7172
let pr = IntlPluralRules::create(&pr_locale, PluralRuleType::CARDINAL).unwrap();
7273
FluentBundle {
@@ -83,7 +84,9 @@ impl<'bundle> FluentBundle<'bundle> {
8384
pub fn add_function<F>(&mut self, id: &str, func: F) -> Result<(), FluentError>
8485
where
8586
F: 'bundle
86-
+ Fn(&[Option<FluentValue>], &HashMap<String, FluentValue>) -> Option<FluentValue> + Sync + Send,
87+
+ Fn(&[Option<FluentValue>], &HashMap<String, FluentValue>) -> Option<FluentValue>
88+
+ Sync
89+
+ Send,
8790
{
8891
match self.entries.entry(id.to_owned()) {
8992
HashEntry::Vacant(entry) => {

fluent/src/entry.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ use std::collections::hash_map::HashMap;
44
use super::types::FluentValue;
55
use fluent_syntax::ast;
66

7-
type FluentFunction<'bundle> =
8-
Box<'bundle + Fn(&[Option<FluentValue>], &HashMap<String, FluentValue>) -> Option<FluentValue> + Send + Sync>;
7+
type FluentFunction<'bundle> = Box<
8+
'bundle
9+
+ Fn(&[Option<FluentValue>], &HashMap<String, FluentValue>) -> Option<FluentValue>
10+
+ Send
11+
+ Sync,
12+
>;
913

1014
pub enum Entry<'bundle> {
1115
Message(ast::Message),

fluent/src/errors.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ use fluent_syntax::parser::errors::ParserError;
33

44
#[derive(Debug, Fail, PartialEq)]
55
pub enum FluentError {
6-
#[fail(
7-
display = "attempted to override an existing {}: {}",
8-
kind,
9-
id
10-
)]
6+
#[fail(display = "attempted to override an existing {}: {}", kind, id)]
117
Overriding { kind: &'static str, id: String },
128
#[fail(display = "Parser error")]
139
ParserError(ParserError),

fluent/tests/bundle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ fn create_bundle<'a, 'b>(locales: &'b Vec<&'b str>) -> FluentBundle<'a> {
4646

4747
#[test]
4848
fn bundle_locale_diff_scope() {
49-
let locales = vec!("x-testing");
49+
let locales = vec!["x-testing"];
5050
create_bundle(&locales);
5151
}

0 commit comments

Comments
 (0)