fix linting issues and ignore derive docs for tests

This commit is contained in:
alexpasmantier 2024-10-31 14:08:10 +01:00
parent 7045295e12
commit 40f466548b
6 changed files with 22 additions and 27 deletions

View File

@ -33,8 +33,10 @@
- [x] support for images is implemented but do we really want that in the core? - [x] support for images is implemented but do we really want that in the core?
it's quite heavy it's quite heavy
- [x] shrink entry names that are too long (from the middle) - [x] shrink entry names that are too long (from the middle)
- [ ] more syntaxes for the previewer https://www.sublimetext.com/docs/syntax.html#include-syntax
- [ ] more preview colorschemes
## feature ideas ## features
- [x] environment variables - [x] environment variables
- [x] aliases - [x] aliases

View File

@ -110,11 +110,7 @@ impl Channel {
); );
let injector = matcher.injector(); let injector = matcher.injector();
let load_handle = tokio::spawn(async move { let load_handle = tokio::spawn(async move {
let mut lines_in_mem = 0; for entry in entries.into_iter().take(MAX_LINES_IN_MEM) {
for entry in entries {
if lines_in_mem > MAX_LINES_IN_MEM {
break;
}
injector.push( injector.push(
CandidateLine::new( CandidateLine::new(
entry.display_name().into(), entry.display_name().into(),
@ -125,7 +121,6 @@ impl Channel {
cols[0] = c.line.clone().into(); cols[0] = c.line.clone().into();
}, },
); );
lines_in_mem += 1;
} }
}); });

View File

@ -333,14 +333,11 @@ impl Television {
} }
} }
} }
Action::CopyEntryToClipboard => match self.mode { Action::CopyEntryToClipboard => if self.mode == Mode::Channel {
Mode::Channel => {
if let Some(entry) = self.get_selected_entry(None) { if let Some(entry) = self.get_selected_entry(None) {
let mut ctx = ClipboardContext::new().unwrap(); let mut ctx = ClipboardContext::new().unwrap();
ctx.set_contents(entry.name).unwrap(); ctx.set_contents(entry.name).unwrap();
} }
}
_ => {}
}, },
Action::ToggleSendToChannel => match self.mode { Action::ToggleSendToChannel => match self.mode {
Mode::Channel | Mode::RemoteControl => { Mode::Channel | Mode::RemoteControl => {

View File

@ -30,6 +30,7 @@ pub struct Layout {
} }
impl Layout { impl Layout {
#[allow(clippy::too_many_arguments)]
pub fn new( pub fn new(
help_bar_left: Rect, help_bar_left: Rect,
help_bar_middle: Rect, help_bar_middle: Rect,

View File

@ -98,7 +98,7 @@ impl Television {
let preview_block = self.build_preview_paragraph( let preview_block = self.build_preview_paragraph(
preview_inner_block, preview_inner_block,
inner, inner,
&preview, preview,
selected_entry selected_entry
.line_number .line_number
.map(|l| u16::try_from(l).unwrap_or(0)), .map(|l| u16::try_from(l).unwrap_or(0)),

View File

@ -4,7 +4,7 @@ use quote::quote;
/// This macro generates a `CliChannel` enum and the necessary glue code /// This macro generates a `CliChannel` enum and the necessary glue code
/// to convert into a `TelevisionChannel` member: /// to convert into a `TelevisionChannel` member:
/// ///
/// ```rust /// ```ignore
/// use crate::channels::{TelevisionChannel, OnAir}; /// use crate::channels::{TelevisionChannel, OnAir};
/// use television_derive::ToCliChannel; /// use television_derive::ToCliChannel;
/// use crate::channels::{files, text}; /// use crate::channels::{files, text};
@ -122,7 +122,7 @@ fn impl_cli_channel(ast: &syn::DeriveInput) -> TokenStream {
/// and forwards the method calls to the corresponding channel variants. /// and forwards the method calls to the corresponding channel variants.
/// ///
/// Example: /// Example:
/// ```rust /// ```ignore
/// use television_derive::Broadcast; /// use television_derive::Broadcast;
/// use crate::channels::{TelevisionChannel, OnAir}; /// use crate::channels::{TelevisionChannel, OnAir};
/// use crate::channels::{files, text}; /// use crate::channels::{files, text};