~goorzhel/radm

763754747a54f25dfabdcda26f87b2a4cf0742d9 — Antonio Gurgel 3 months ago b24bf5a
Document choose_sessions panic
1 files changed, 6 insertions(+), 3 deletions(-)

M src/user.rs
M src/user.rs => src/user.rs +6 -3
@@ 142,9 142,12 @@ impl User {

    /// Prompts user to choose a session from a numbered list.
    ///
    /// `sessions` is assumed to have been gathered by
    /// [`find_sessions`](crate::session::find_sessions) and hence be non-empty. If `sessions` has
    /// one item, it will be returned automatically.
    /// If `sessions` has one item, it will be returned automatically.
    ///
    /// # Panics
    ///
    /// Panics if `sessions` is empty. Providing a non-empty list is up to
    /// [`find_sessions`](crate::session::find_sessions).
    pub fn choose_session(&self, sessions: &[Desktop], xdg: &BaseDirectories) -> Result<Desktop> {
        if sessions.is_empty() {
            panic!("choose_session() cannot choose among zero sessions");