matthias-t / workspace

Mirror of https://git.sr.ht/~matthias_t/workspace
MIT License
0 stars 1 forks source link

Fix borrowing problems. Use unwrap_or instead of match #49

Closed roma0615 closed 6 years ago

roma0615 commented 6 years ago

These are the changes I made to get the code to compile on my computer. I also thought it would make more sense to use unwrap_or instead of a match statement.

matthias-t commented 6 years ago

Using unwrap_or is a good idea, however I don't understand why the other changes are necessary. Could you provide some information about your environment (rust toolchain) and the compiler errors that this fixes?

roma0615 commented 6 years ago

Running rustup show gave me this result:

Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.25.0 (84203cac6 2018-03-25)

So I'm using the stable-x86_64-apple-darwin toolchain. Should I try running rustup update?

matthias-t commented 6 years ago

Yes, try that. The latest stable is

rustc 1.27.2 (58cc626de 2018-07-18)
matthias-t commented 6 years ago

We don't care about supporting older releases because this is not a library. Until recently most stuff in the rust ecosystem only built on the latest nightly anyway. We're lucky that rust-clippy is finally coming to stable.

roma0615 commented 6 years ago

After updating to the latest stable and checking out result-parse, the code compiled. I will make sure to update rust more often in the future!

I still think we could keep the unwrap_or change, so I'll push another change to this branch removing the borrowing related changes that I made. Then we could squash when merging to result-parse to clean up the history.

matthias-t commented 6 years ago

@roma0615 perfect 💯