Skip to content

Commit

Permalink
Resolve Rust 1.75's new get_first clippy lint
Browse files Browse the repository at this point in the history
    warning: accessing first element with `values.get(0)`
      --> src/i18n.rs:20:31
       |
    20 |             let email = match values.get(0) {
       |                               ^^^^^^^^^^^^^ help: try: `values.first()`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
       = note: `#[warn(clippy::get_first)]` on by default

    warning: accessing first element with `values.get(0)`
      --> src/i18n.rs:30:30
       |
    30 |             let text = match values.get(0) {
       |                              ^^^^^^^^^^^^^ help: try: `values.first()`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
  • Loading branch information
dtolnay committed Jan 9, 2024
1 parent b352151 commit 0ed652d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ simple_loader!(create_loader, "./locales/", "en-US", core: "./locales/core.ftl",
fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {
bundle
.add_function("EMAIL", |values, _named| {
let email = match values.get(0) {
let email = match values.first() {
Some(FluentValue::String(ref s)) => s,
_ => return FluentValue::None,
};
Expand All @@ -27,7 +27,7 @@ fn add_bundle_functions(bundle: &mut FluentBundle<&'static FluentResource>) {

bundle
.add_function("ENGLISH", |values, _named| {
let text = match values.get(0) {
let text = match values.first() {
Some(FluentValue::String(ref s)) => s,
_ => return FluentValue::None,
};
Expand Down

0 comments on commit 0ed652d

Please sign in to comment.