rust , an Random Englisch
@rust@octodon.social avatar

You never need more than one .and_then(…) or .map(…).flatten(),
because the ? operator works inside the closure.

maybe_object<br></br>    .and_then(|o| o.path.file_name())<br></br>    .and_then(|p| p.to_str())<br></br>    .and_then(|s| {<br></br>        delim.and_then(|d| s.split_once(d))<br></br>    })<br></br><br></br>maybe_object.and_then(|o| {<br></br>    o.path.file_name()?.to_str()?.split_once(delim?)<br></br>})<br></br>

ekuber , an Random Englisch
@ekuber@hachyderm.io avatar

My coworkers ask for help with a compiler error... once...

...and then I run and try to mechanize my explanation and put it back in the compiler.

Our dev tools need to talk to humans in the way humans talk. Nobody is an expert on everything, helping newcomers (with better tools, better docs, better errors) helps everyone.

That's really the trick behind the rustc diagnostic output: it's not about a technology, its an attitude.

romac , an Random Englisch
@romac@hachyderm.io avatar

TIL in Rust one can use .. in tuple patterns to omit elements, much like in struct patterns:

fn foo() -> usize {
match (1, true, "foo", 2) {
(1, .., y) => y,
(x, true, ..) => x + 1,
(.., foo, y) => foo.len() + y
}
}

tb , an Random
@tb@hachyderm.io avatar

:ferris_gesture: crates.io has an experimental dark UI mode now! 😱

we finally implemented our most upvoted feature request over the past weeks. while we are still searching for potential issues, the default mode is "Light". once we feel confident about the dark mode we will switch it over to "System".

let us know via https://github.com/rust-lang/crates.io/issues if you find any issues!

image/png

imperio , an Random Englisch
@imperio@toot.cat avatar

Next Paris @rust meetup will be on the 11th at the Sorbonne university!

This time, we are also sponsored by the Rust Foundation!

You can register here: https://mobilizon.fr/events/681b42dd-a456-4bfc-99e2-d1c60e867cbb

See you there!

  • Alle
  • Abonniert
  • Moderiert
  • Favoriten
  • random
  • haupteingang
  • Alle Magazine