diff --git a/include/engine/guidance/collapse_turns.hpp b/include/engine/guidance/collapse_turns.hpp index 65c3eddb9..bfd1140f2 100644 --- a/include/engine/guidance/collapse_turns.hpp +++ b/include/engine/guidance/collapse_turns.hpp @@ -11,16 +11,15 @@ namespace osrm::engine::guidance // Multiple possible reasons can result in unnecessary/confusing instructions // Collapsing such turns into a single turn instruction, we give a clearer // set of instructions that is not cluttered by unnecessary turns/name changes. -[[nodiscard]] -std::vector collapseTurnInstructions(std::vector steps); +[[nodiscard]] std::vector collapseTurnInstructions(std::vector steps); // Multiple possible reasons can result in unnecessary/confusing instructions // A prime example would be a segregated intersection. Turning around at this // intersection would result in two instructions to turn left. // Collapsing such turns into a single turn instruction, we give a clearer // set of instructions that is not cluttered by unnecessary turns/name changes. -[[nodiscard]] -std::vector collapseSegregatedTurnInstructions(std::vector steps); +[[nodiscard]] std::vector +collapseSegregatedTurnInstructions(std::vector steps); // A combined turn is a set of two instructions that actually form a single turn, as far as we // perceive it. A u-turn consisting of two left turns is one such example. But there are also lots diff --git a/include/engine/guidance/collapsing_utility.hpp b/include/engine/guidance/collapsing_utility.hpp index 4cb40b674..9177ef8d4 100644 --- a/include/engine/guidance/collapsing_utility.hpp +++ b/include/engine/guidance/collapsing_utility.hpp @@ -165,8 +165,7 @@ inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs) } // do this after invalidating any steps to compress the step array again -[[nodiscard]] -inline std::vector removeNoTurnInstructions(std::vector steps) +[[nodiscard]] inline std::vector removeNoTurnInstructions(std::vector steps) { // finally clean up the post-processed instructions. // Remove all invalid instructions from the set of instructions. diff --git a/include/engine/guidance/lane_processing.hpp b/include/engine/guidance/lane_processing.hpp index df18b3b7c..0448151cb 100644 --- a/include/engine/guidance/lane_processing.hpp +++ b/include/engine/guidance/lane_processing.hpp @@ -13,9 +13,9 @@ namespace osrm::engine::guidance // we anticipate lane changes emitting only matching lanes early on. // the second parameter describes the duration that we feel two segments need to be apart to count // as separate maneuvers. -[[nodiscard]] -std::vector anticipateLaneChange(std::vector steps, - const double min_distance_needed_for_lane_change = 200); +[[nodiscard]] std::vector +anticipateLaneChange(std::vector steps, + const double min_distance_needed_for_lane_change = 200); } // namespace osrm::engine::guidance diff --git a/include/engine/guidance/post_processing.hpp b/include/engine/guidance/post_processing.hpp index 9ac6bed57..22ed7aae2 100644 --- a/include/engine/guidance/post_processing.hpp +++ b/include/engine/guidance/post_processing.hpp @@ -12,8 +12,7 @@ namespace osrm::engine::guidance { // passed as none-reference to modify in-place and move out again -[[nodiscard]] -std::vector handleRoundabouts(std::vector steps); +[[nodiscard]] std::vector handleRoundabouts(std::vector steps); // trim initial/final segment of very short length. // This function uses in/out parameter passing to modify both steps and geometry in place. @@ -23,23 +22,21 @@ std::vector handleRoundabouts(std::vector steps); void trimShortSegments(std::vector &steps, LegGeometry &geometry); // assign relative locations to depart/arrive instructions -[[nodiscard]] -std::vector assignRelativeLocations(std::vector steps, - const LegGeometry &geometry, - const PhantomNode &source_node, - const PhantomNode &target_node); +[[nodiscard]] std::vector assignRelativeLocations(std::vector steps, + const LegGeometry &geometry, + const PhantomNode &source_node, + const PhantomNode &target_node); // collapse suppressed instructions remaining into intersections array -[[nodiscard]] -std::vector buildIntersections(std::vector steps); +[[nodiscard]] std::vector buildIntersections(std::vector steps); // postProcess will break the connection between the leg geometry // for which a segment is supposed to represent exactly the coordinates // between routing maneuvers and the route steps itself. // If required, we can get both in sync again using this function. // Move in LegGeometry for modification in place. -[[nodiscard]] -LegGeometry resyncGeometry(LegGeometry leg_geometry, const std::vector &steps); +[[nodiscard]] LegGeometry resyncGeometry(LegGeometry leg_geometry, + const std::vector &steps); /** * Apply maneuver override relations to the selected route. diff --git a/include/engine/guidance/verbosity_reduction.hpp b/include/engine/guidance/verbosity_reduction.hpp index 445b61385..ae5dca97c 100644 --- a/include/engine/guidance/verbosity_reduction.hpp +++ b/include/engine/guidance/verbosity_reduction.hpp @@ -12,8 +12,7 @@ namespace osrm::engine::guidance // to announce them. All these that are not collapsed into a single turn (think segregated // intersection) have to be checked for the length they are active in. If they are active for a // short distance only, we don't announce them -[[nodiscard]] -std::vector suppressShortNameSegments(std::vector steps); +[[nodiscard]] std::vector suppressShortNameSegments(std::vector steps); } // namespace osrm::engine::guidance diff --git a/include/extractor/intersection/coordinate_extractor.hpp b/include/extractor/intersection/coordinate_extractor.hpp index 18ce09747..8e9a527b6 100644 --- a/include/extractor/intersection/coordinate_extractor.hpp +++ b/include/extractor/intersection/coordinate_extractor.hpp @@ -26,17 +26,16 @@ class CoordinateExtractor * Note: The segment between intersection and turn coordinate can be zero, if the OSM modelling * is unfortunate. See https://github.com/Project-OSRM/osrm-backend/issues/3470 */ - [[nodiscard]] - util::Coordinate GetCoordinateAlongRoad(const NodeID intersection_node, - const EdgeID turn_edge, - const bool traversed_in_reverse, - const NodeID to_node, - const std::uint8_t number_of_in_lanes) const; + [[nodiscard]] util::Coordinate + GetCoordinateAlongRoad(const NodeID intersection_node, + const EdgeID turn_edge, + const bool traversed_in_reverse, + const NodeID to_node, + const std::uint8_t number_of_in_lanes) const; // Given a set of precomputed coordinates, select the representative coordinate along the road // that best describes the turn - [[nodiscard]] - util::Coordinate + [[nodiscard]] util::Coordinate ExtractRepresentativeCoordinate(const NodeID intersection_node, const EdgeID turn_edge, const bool traversed_in_reverse, @@ -54,20 +53,18 @@ class CoordinateExtractor // wrapper in case of normal forward edges (traversed_in_reverse = false, to_node = // node_based_graph.GetTarget(turn_edge) - [[nodiscard]] - std::vector GetForwardCoordinatesAlongRoad(const NodeID from, - const EdgeID turn_edge) const; + [[nodiscard]] std::vector + GetForwardCoordinatesAlongRoad(const NodeID from, const EdgeID turn_edge) const; // a less precise way to compute coordinates along a route. Due to the heavy interaction of // graph traversal and turn instructions, we often don't care for high precision. We only want // to check for available connections in order, or find (with room for error) the straightmost // turn. This function will offer a bit more error potential but allow for much higher // performance - [[nodiscard]] - util::Coordinate GetCoordinateCloseToTurn(const NodeID from_node, - const EdgeID turn_edge, - const bool traversed_in_reverse, - const NodeID to_node) const; + [[nodiscard]] util::Coordinate GetCoordinateCloseToTurn(const NodeID from_node, + const EdgeID turn_edge, + const bool traversed_in_reverse, + const NodeID to_node) const; /* When extracting the coordinates, we first extract all coordinates. We don't care about most * of them, though. @@ -89,22 +86,19 @@ class CoordinateExtractor * The optional length cache needs to store the accumulated distance up to the respective * coordinate index [0,d(0,1),...] */ - [[nodiscard]] - std::vector + [[nodiscard]] std::vector TrimCoordinatesToLength(std::vector coordinates, const double desired_length, const std::vector &length_cache = {}) const; - [[nodiscard]] - std::vector PrepareLengthCache(const std::vector &coordinates, - const double limit) const; + [[nodiscard]] std::vector + PrepareLengthCache(const std::vector &coordinates, const double limit) const; /* when looking at a set of coordinates, this function allows trimming the vector to a smaller, * only containing coordinates up to a given distance along the path. The last coordinate might * be interpolated */ - [[nodiscard]] - std::vector + [[nodiscard]] std::vector TrimCoordinatesByLengthFront(std::vector coordinates, const double desired_length) const; @@ -129,10 +123,9 @@ class CoordinateExtractor * * for fixpoint `b`, vector_base `d` and vector_head `e` */ - [[nodiscard]] - util::Coordinate GetCorrectedCoordinate(const util::Coordinate fixpoint, - const util::Coordinate vector_base, - const util::Coordinate vector_head) const; + [[nodiscard]] util::Coordinate GetCorrectedCoordinate(const util::Coordinate fixpoint, + const util::Coordinate vector_base, + const util::Coordinate vector_head) const; /* generate a uniform vector of coordinates in same range distances * @@ -142,8 +135,7 @@ class CoordinateExtractor * Into: * x -- x -- x -- x -- x - x */ - [[nodiscard]] - std::vector + [[nodiscard]] std::vector SampleCoordinates(const std::vector &coordinates, const double length, const double rate) const; diff --git a/include/guidance/motorway_handler.hpp b/include/guidance/motorway_handler.hpp index d0caae3bd..8f399156d 100644 --- a/include/guidance/motorway_handler.hpp +++ b/include/guidance/motorway_handler.hpp @@ -41,18 +41,14 @@ class MotorwayHandler final : public IntersectionHandler Intersection intersection) const override final; private: - [[nodiscard]] - Intersection handleSliproads(const NodeID intersection_node_id, - Intersection intersection) const; + [[nodiscard]] Intersection handleSliproads(const NodeID intersection_node_id, + Intersection intersection) const; - [[nodiscard]] - Intersection fromMotorway(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection fromMotorway(const EdgeID via_edge, Intersection intersection) const; - [[nodiscard]] - Intersection fromRamp(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection fromRamp(const EdgeID via_edge, Intersection intersection) const; - [[nodiscard]] - Intersection fallback(Intersection intersection) const; + [[nodiscard]] Intersection fallback(Intersection intersection) const; }; } // namespace osrm::guidance diff --git a/include/guidance/parsing_toolkit.hpp b/include/guidance/parsing_toolkit.hpp index 9f92d5c58..56cbb5fae 100644 --- a/include/guidance/parsing_toolkit.hpp +++ b/include/guidance/parsing_toolkit.hpp @@ -19,8 +19,7 @@ namespace osrm::extractor::guidance // will be corrected to left|throught, since the final lane is not drivable. // This is in contrast to a situation with lanes:psv:forward=0 (or not set) where left|through| // represents left|through|through -[[nodiscard]] -inline std::string +[[nodiscard]] inline std::string trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t count_right) { if (count_left) @@ -66,8 +65,8 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co // turn:lanes=left|through|through|right // vehicle:lanes=yes|yes|no|yes // bicycle:lanes=yes|no|designated|yes -[[nodiscard]] -inline std::string applyAccessTokens(std::string lane_string, const std::string &access_tokens) +[[nodiscard]] inline std::string applyAccessTokens(std::string lane_string, + const std::string &access_tokens) { using tokenizer = boost::tokenizer>; boost::char_separator sep("|", "", boost::keep_empty_tokens); diff --git a/include/guidance/turn_analysis.hpp b/include/guidance/turn_analysis.hpp index 5dceb469a..d17ea0c03 100644 --- a/include/guidance/turn_analysis.hpp +++ b/include/guidance/turn_analysis.hpp @@ -46,13 +46,11 @@ class TurnAnalysis /* Full Analysis Process for a single node/edge combination. Use with caution, as the process is * relatively expensive */ - [[nodiscard]] - Intersection operator()(const NodeID node_prior_to_intersection, - const EdgeID entering_via_edge) const; + [[nodiscard]] Intersection operator()(const NodeID node_prior_to_intersection, + const EdgeID entering_via_edge) const; // Select turn types based on the intersection shape - [[nodiscard]] - Intersection + [[nodiscard]] Intersection AssignTurnTypes(const NodeID from_node, const EdgeID via_eid, const extractor::intersection::IntersectionView &intersection) const; diff --git a/include/guidance/turn_handler.hpp b/include/guidance/turn_handler.hpp index e9a0529d1..88b9daae0 100644 --- a/include/guidance/turn_handler.hpp +++ b/include/guidance/turn_handler.hpp @@ -75,20 +75,19 @@ class TurnHandler final : public IntersectionHandler bool isCompatibleByRoadClass(const Intersection &intersection, const Fork fork) const; // Dead end. - [[nodiscard]] - Intersection handleOneWayTurn(Intersection intersection) const; + [[nodiscard]] Intersection handleOneWayTurn(Intersection intersection) const; // Mode Changes, new names... - [[nodiscard]] - Intersection handleTwoWayTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleTwoWayTurn(const EdgeID via_edge, + Intersection intersection) const; // Forks, T intersections and similar - [[nodiscard]] - Intersection handleThreeWayTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleThreeWayTurn(const EdgeID via_edge, + Intersection intersection) const; // Handling of turns larger then degree three - [[nodiscard]] - Intersection handleComplexTurn(const EdgeID via_edge, Intersection intersection) const; + [[nodiscard]] Intersection handleComplexTurn(const EdgeID via_edge, + Intersection intersection) const; void handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const; @@ -96,15 +95,13 @@ class TurnHandler final : public IntersectionHandler // Classification std::optional findFork(const EdgeID via_edge, Intersection &intersection) const; - [[nodiscard]] - Intersection assignLeftTurns(const EdgeID via_edge, - Intersection intersection, - const std::size_t starting_at) const; + [[nodiscard]] Intersection assignLeftTurns(const EdgeID via_edge, + Intersection intersection, + const std::size_t starting_at) const; - [[nodiscard]] - Intersection assignRightTurns(const EdgeID via_edge, - Intersection intersection, - const std::size_t up_to) const; + [[nodiscard]] Intersection assignRightTurns(const EdgeID via_edge, + Intersection intersection, + const std::size_t up_to) const; }; } // namespace osrm::guidance diff --git a/include/guidance/turn_instruction.hpp b/include/guidance/turn_instruction.hpp index bf41cc91d..83132ac24 100644 --- a/include/guidance/turn_instruction.hpp +++ b/include/guidance/turn_instruction.hpp @@ -242,8 +242,7 @@ inline guidance::DirectionModifier::Enum getTurnDirection(const double angle) } // swaps left <-> right modifier types -[[nodiscard]] -inline guidance::DirectionModifier::Enum +[[nodiscard]] inline guidance::DirectionModifier::Enum mirrorDirectionModifier(const guidance::DirectionModifier::Enum modifier) { const constexpr guidance::DirectionModifier::Enum results[] = { diff --git a/include/guidance/turn_lane_augmentation.hpp b/include/guidance/turn_lane_augmentation.hpp index d7913b82d..81ec3abe9 100644 --- a/include/guidance/turn_lane_augmentation.hpp +++ b/include/guidance/turn_lane_augmentation.hpp @@ -7,9 +7,8 @@ namespace osrm::guidance::lanes { -[[nodiscard]] -LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data, - const Intersection &intersection); +[[nodiscard]] LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data, + const Intersection &intersection); } // namespace osrm::guidance::lanes diff --git a/include/guidance/turn_lane_data.hpp b/include/guidance/turn_lane_data.hpp index 21408a97a..53635d014 100644 --- a/include/guidance/turn_lane_data.hpp +++ b/include/guidance/turn_lane_data.hpp @@ -22,8 +22,8 @@ struct TurnLaneData using LaneDataVector = std::vector; // convertes a string given in the OSM format into a TurnLaneData vector -[[nodiscard]] -LaneDataVector laneDataFromDescription(const extractor::TurnLaneDescription &turn_lane_description); +[[nodiscard]] LaneDataVector +laneDataFromDescription(const extractor::TurnLaneDescription &turn_lane_description); // Locate A Tag in a lane data vector (if multiple tags are set, the first one found is returned) LaneDataVector::const_iterator findTag(const extractor::TurnLaneType::Mask tag, diff --git a/include/guidance/turn_lane_handler.hpp b/include/guidance/turn_lane_handler.hpp index 324f28e2f..9994867a3 100644 --- a/include/guidance/turn_lane_handler.hpp +++ b/include/guidance/turn_lane_handler.hpp @@ -67,8 +67,8 @@ class TurnLaneHandler ~TurnLaneHandler(); - [[nodiscard]] - Intersection assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection); + [[nodiscard]] Intersection + assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection); private: mutable std::atomic count_handled; @@ -107,24 +107,23 @@ class TurnLaneHandler const Intersection &intersection) const; // in case of a simple intersection, assign the lane entries - [[nodiscard]] - Intersection simpleMatchTuplesToTurns(Intersection intersection, - const LaneDataVector &lane_data, - const LaneDescriptionID lane_string_id); + [[nodiscard]] Intersection simpleMatchTuplesToTurns(Intersection intersection, + const LaneDataVector &lane_data, + const LaneDescriptionID lane_string_id); // partition lane data into lane data relevant at current turn and at next turn - [[nodiscard]] - std::pair partitionLaneData( - const NodeID at, LaneDataVector turn_lane_data, const Intersection &intersection) const; + [[nodiscard]] std::pair + partitionLaneData(const NodeID at, + LaneDataVector turn_lane_data, + const Intersection &intersection) const; // Sliproad turns have a separated lane to the right/left of other depicted lanes. These lanes // are not necessarily separated clearly from the rest of the way. As a result, we combine both // lane entries for our output, while performing the matching with the separated lanes only. - [[nodiscard]] - Intersection handleSliproadTurn(Intersection intersection, - const LaneDescriptionID lane_description_id, - LaneDataVector lane_data, - const Intersection &previous_intersection); + [[nodiscard]] Intersection handleSliproadTurn(Intersection intersection, + const LaneDescriptionID lane_description_id, + LaneDataVector lane_data, + const Intersection &previous_intersection); // get the lane data for an intersection void extractLaneData(const EdgeID via_edge, diff --git a/include/guidance/turn_lane_matcher.hpp b/include/guidance/turn_lane_matcher.hpp index 5ca3deacb..df1965535 100644 --- a/include/guidance/turn_lane_matcher.hpp +++ b/include/guidance/turn_lane_matcher.hpp @@ -33,12 +33,12 @@ findBestMatchForReverse(const extractor::TurnLaneType::Mask leftmost_tag, bool canMatchTrivially(const Intersection &intersection, const LaneDataVector &lane_data); // perform a trivial match on the turn lanes -[[nodiscard]] -Intersection triviallyMatchLanesToTurns(Intersection intersection, - const LaneDataVector &lane_data, - const util::NodeBasedDynamicGraph &node_based_graph, - const LaneDescriptionID lane_string_id, - util::guidance::LaneDataIdMap &lane_data_to_id); +[[nodiscard]] Intersection +triviallyMatchLanesToTurns(Intersection intersection, + const LaneDataVector &lane_data, + const util::NodeBasedDynamicGraph &node_based_graph, + const LaneDescriptionID lane_string_id, + util::guidance::LaneDataIdMap &lane_data_to_id); } // namespace osrm::guidance::lanes diff --git a/src/engine/guidance/collapse_turns.cpp b/src/engine/guidance/collapse_turns.cpp index 07a3d853a..535a7539b 100644 --- a/src/engine/guidance/collapse_turns.cpp +++ b/src/engine/guidance/collapse_turns.cpp @@ -433,8 +433,7 @@ void suppressStep(RouteStep &step_at_turn_location, RouteStep &step_after_turn_l } // OTHER IMPLEMENTATIONS -[[nodiscard]] -RouteSteps collapseTurnInstructions(RouteSteps steps) +[[nodiscard]] RouteSteps collapseTurnInstructions(RouteSteps steps) { // make sure we can safely iterate over all steps (has depart/arrive with TurnType::NoTurn) BOOST_ASSERT(!hasTurnType(steps.front()) && !hasTurnType(steps.back())); @@ -589,8 +588,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps) } // OTHER IMPLEMENTATIONS -[[nodiscard]] -RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps) +[[nodiscard]] RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps) { // make sure we can safely iterate over all steps (has depart/arrive with TurnType::NoTurn) BOOST_ASSERT(!hasTurnType(steps.front()) && !hasTurnType(steps.back()));