This might seem a bit long-winded, but... a variation on this..
- Set snap to 'Active' and 'Vertex', and in the snap panel, set it to affect rotation
- Set Pivot to '3D Cursor'
- Set Transform Orientation to 'View'
- Establish one end of the snap. With all selected, make the vertex at one end of the source (moving) object active, and snap it to the corresponding end of the target edge. ShiftS > send the 3D cursor to the same spot. It will be the center of rotation.
- Establish the plane of rotation. ShiftD duplicate the vertex at the other end of the source object, and snap the duplicate to the other end of the target. With all source vertices selected, F create a temporary triangular face, and ShiftNumpad 7 align the view to the face
- Delete the duplicate vertex, (and the face, with it)
- With all source vertices selected, and the loose end vertex active, R rotate it into place.
This takes longer to describe than it takes to do.. usually there are convenient faces / whatever already hanging around.. you wouldn't have to create them specially, as in this example. Maybe, instead of using the View orientation, you would create a Custom Orientation from a selection of vertices, edges, or faces (either existing, or temporarily created for the purpose).