From 48c85d522095b4425038860bc77b2f8cb22c78dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?joseLu=C3=ADs?= Date: Tue, 15 Jun 2021 00:36:39 +0200 Subject: [PATCH] [rust] rustfmt; fix docs --- rust/src/cells/reimplemented.rs | 6 +++--- rust/src/channel/reimplemented.rs | 6 +++--- rust/src/channel/test/reimplemented.rs | 3 +-- rust/src/palette/methods.rs | 4 ++-- rust/src/visual/methods.rs | 9 +++------ 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rust/src/cells/reimplemented.rs b/rust/src/cells/reimplemented.rs index 792e1634c..57f81c8ad 100644 --- a/rust/src/cells/reimplemented.rs +++ b/rust/src/cells/reimplemented.rs @@ -4,9 +4,9 @@ use libc::strcmp; use crate::{ cstring, nccell_release, NcAlphaBits, NcCell, NcChannel, NcChannelPair, NcColor, NcEgc, - NcIntResult, NcPaletteIndex, NcPlane, NcRgb, NcStyleMask, NCCELL_OPAQUE, - NCCELL_BGDEFAULT_MASK, NCCELL_BG_PALETTE, NCCELL_FGDEFAULT_MASK, NCCELL_FG_PALETTE, - NCRESULT_ERR, NCRESULT_OK, NCSTYLE_MASK, + NcIntResult, NcPaletteIndex, NcPlane, NcRgb, NcStyleMask, NCCELL_BGDEFAULT_MASK, + NCCELL_BG_PALETTE, NCCELL_FGDEFAULT_MASK, NCCELL_FG_PALETTE, NCCELL_OPAQUE, NCRESULT_ERR, + NCRESULT_OK, NCSTYLE_MASK, }; // Alpha ----------------------------------------------------------------------- diff --git a/rust/src/channel/reimplemented.rs b/rust/src/channel/reimplemented.rs index 15c961a10..6507d03a1 100644 --- a/rust/src/channel/reimplemented.rs +++ b/rust/src/channel/reimplemented.rs @@ -1,9 +1,9 @@ //! `channel*_*` reimplemented functions. use crate::{ - NcAlphaBits, NcChannel, NcChannelPair, NcColor, NcPaletteIndex, NcRgb, - NCCELL_HIGHCONTRAST, NCCELL_OPAQUE, NCCELL_BGDEFAULT_MASK, NCCELL_BG_PALETTE, - NCCELL_BG_RGB_MASK, NCCELL_FGDEFAULT_MASK, NCCELL_FG_PALETTE, NCCHANNEL_ALPHA_MASK, + NcAlphaBits, NcChannel, NcChannelPair, NcColor, NcPaletteIndex, NcRgb, NCCELL_BGDEFAULT_MASK, + NCCELL_BG_PALETTE, NCCELL_BG_RGB_MASK, NCCELL_FGDEFAULT_MASK, NCCELL_FG_PALETTE, + NCCELL_HIGHCONTRAST, NCCELL_OPAQUE, NCCHANNEL_ALPHA_MASK, }; // Alpha ----------------------------------------------------------------------- diff --git a/rust/src/channel/test/reimplemented.rs b/rust/src/channel/test/reimplemented.rs index ad1e8b47c..0c10cfcf8 100644 --- a/rust/src/channel/test/reimplemented.rs +++ b/rust/src/channel/test/reimplemented.rs @@ -3,8 +3,7 @@ use serial_test::serial; use crate::{ - NcChannel, NcChannelPair, NCCELL_BLEND, NCCELL_HIGHCONTRAST, NCCELL_OPAQUE, - NCCELL_TRANSPARENT, + NcChannel, NcChannelPair, NCCELL_BLEND, NCCELL_HIGHCONTRAST, NCCELL_OPAQUE, NCCELL_TRANSPARENT, }; // NcChannel tests ------------------------------------------------------------- diff --git a/rust/src/palette/methods.rs b/rust/src/palette/methods.rs index a5e77316d..3b99aacaa 100644 --- a/rust/src/palette/methods.rs +++ b/rust/src/palette/methods.rs @@ -28,7 +28,7 @@ impl NcPalette { /// Returns the [NcColor] RGB components from the [NcChannel] in this NcPalette. /// - /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb].* + /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb8].* pub fn get_rgb8(&self, index: NcPaletteIndex) -> (NcColor, NcColor, NcColor) { let (mut r, mut g, mut b) = (0, 0, 0); crate::ncchannel_rgb8(self.chans[index as usize], &mut r, &mut g, &mut b); @@ -38,7 +38,7 @@ impl NcPalette { /// Extracts the [NcColor] RGB components from an [NcChannel] entry inside /// this NcPalette, and returns the NcChannel. /// - /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb].* + /// *C style function: [ncpalette_get_rgb()][crate::ncpalette_get_rgb8].* pub fn get_rgb(&self, index: NcPaletteIndex) -> NcChannel { let (mut r, mut g, mut b) = (0, 0, 0); crate::ncchannel_rgb8(self.chans[index as usize], &mut r, &mut g, &mut b) diff --git a/rust/src/visual/methods.rs b/rust/src/visual/methods.rs index 7fede6a7a..de9d6deff 100644 --- a/rust/src/visual/methods.rs +++ b/rust/src/visual/methods.rs @@ -363,13 +363,10 @@ impl NcVisual { /// /// *C style function: /// [ncvisual_resize_noninterpolative()][crate::ncvisual_resize_noninterpolative].* - pub fn resize_noninterpolative(&mut self, rows: NcDim, cols: NcDim) -> NcResult { - let res = - unsafe { crate::ncvisual_resize_noninterpolative(self, rows as i32, cols as i32) }; + pub fn resize_noninterpolative(&mut self, rows: NcDim, cols: NcDim) -> NcResult<()> { error![ - res, - &format!["NcVisual.resize_noninterpolative({}, {})", cols, rows], - res + unsafe { crate::ncvisual_resize_noninterpolative(self, rows as i32, cols as i32) }, + &format!["NcVisual.resize_noninterpolative({}, {})", cols, rows] ] }