Code RoomConfig moved in loop
MediumPrep Room Coding #1790

Config moved in loop

Code reviewCode quality & reviewMid–Senior~25 min

Review this Rust function that builds and reuses a connection config.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1struct Config { endpoints: Vec<String> }
2 
3fn dial(cfg: Config) -> std::io::Result<()> {
4 // pretend this connects using the config
5 Ok(())
6}
7 
8fn run() -> std::io::Result<()> {
9 let cfg = Config { endpoints: vec!["a:80".into(), "b:80".into()] };
10 for attempt in 0..3 {
11 println!("attempt {attempt}");
12 dial(cfg)?;
13 }
14 Ok(())
15}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.