Code Room
Code reviewHardcr-g377
Subject Use after freeLevel Senior–Staff~26 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Rust event registration. `Widget` registers a callback that reads its own `label`.

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.

Talk through your review
Code to reviewrust
struct Widget { label: String } impl Widget {    fn register(&self, bus: &mut EventBus) {        bus.on_click(Box::new(|| {            println!("clicked {}", self.label); // borrows self        }));    }}// bus: on_click(&mut self, cb: Box<dyn Fn() + 'static>)
Run or narrate your approach, then ask the coach.