refactor: make api::get_mode() infallible (#247)

This commit is contained in:
Riccardo Mazzarini 2025-05-23 18:09:49 +02:00 committed by GitHub
parent d027f99643
commit 1f10c8fac2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View file

@ -379,8 +379,10 @@ pub fn get_mark(
/// [`GotMode`] is `true` if Neovim is waiting for input.
///
/// [1]: https://neovim.io/doc/user/api.html#nvim_get_mode()
pub fn get_mode() -> Result<GotMode> {
unsafe { nvim_get_mode(types::arena()) }.try_into().map_err(Into::into)
pub fn get_mode() -> GotMode {
unsafe { nvim_get_mode(types::arena()) }
.try_into()
.expect("couldn't get mode")
}
/// Binding to [`nvim_get_proc()`][1].