INDAPlus21 / INDAPlus21/carlch-task-2
Pass
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Very well done Carl!**
Tips: Don't initialise unessecary mutable variables.
_Your code_:
```rust
let mut lines = stream
.lock()
.lines()
.map(|_line| _line
.ok()
.unwrap());
// Collect inputs in a vector
let inputs = lines
.next()
.unwrap()
.split_whitespace()
.map(|_number| _number
.parse::()
.unwrap())
.collect::>();
```
_Optimised version_:
```rust
let inputs = stream
.lock()
.lines()
.next().unwrap()
.ok().unwrap()
.split_whitespace()
.map(|_number| _number.parse().unwrap())
.collect::>();
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Rust input-handling code shown in the issue and compare the mutable `lines` version with the optimized version. Remove the unnecessary mutable binding while preserving the existing input parsing behavior; the work is done when the simpler form is used and the code still compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100