{"record":{"id":"16d064e3bb4b608e","repo":"a-b-street/abstreet","slug":"not-a-turn","errorCode":null,"errorMessage":"not a turn","messagePattern":"not a turn","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"map_model/src/traversable.rs","lineNumber":164,"sourceCode":"pub fn as_turn(&self) -> TurnID {\n    match *self {\n        Traversable::Turn(id) => id,\n        Traversable::Lane(_) => panic!(\"not a turn\"),\n    }\n}\n\npub fn maybe_turn(&self) -> Option<TurnID> {\n    match *self {\n        Traversable::Turn(id) => Some(id),\n        Traversable::Lane(_) => None,\n    }\n}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/traversable.rs#L146-L182","documentation":"Mirror of as_lane: this unwrapping helper on the Traversable enum fires when as_turn is called on a Traversable::Lane variant. The caller asserted the traversable is a turn but it holds a lane ID; maybe_turn exists for non-panicking callers.","triggerScenarios":"Thrown at map_model/src/traversable.rs:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use maybe_turn() and handle the None case instead of as_turn","Match on the Traversable enum explicitly at the call site","Fix upstream logic so only turn traversables reach as_turn"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}