Fix clippy.
This commit is contained in:
		
							parent
							
								
									7d73a3c948
								
							
						
					
					
						commit
						8d85d5ef79
					
				| @ -55,7 +55,7 @@ render!(RenderSrcBlock, ISrcBlock, original, render_context, { | ||||
|             RenderSrcLine { children } | ||||
|         }) | ||||
|         .collect(); | ||||
|     match original.language.as_ref().map(String::as_str) { | ||||
|     match original.language.as_deref() { | ||||
|         Some("bash") => { | ||||
|             render_context | ||||
|                 .dependency_manager | ||||
|  | ||||
| @ -32,6 +32,7 @@ pub(crate) struct IRealFootnoteDefinition { | ||||
| } | ||||
| 
 | ||||
| impl IRealFootnoteDefinition { | ||||
|     #[allow(clippy::needless_lifetimes)] | ||||
|     pub(crate) async fn new<'orig, 'parse>( | ||||
|         _intermediate_context: IntermediateContext<'orig, 'parse>, | ||||
|         footnote_id: usize, | ||||
|  | ||||
| @ -9,6 +9,7 @@ macro_rules! inoop { | ||||
|         } | ||||
| 
 | ||||
|         impl $istruct { | ||||
|             #[allow(clippy::extra_unused_lifetimes)] | ||||
|             pub(crate) async fn new<'reg, 'orig, 'parse>( | ||||
|                 _intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, | ||||
|                 original: &'orig organic::types::$pstruct<'parse>, | ||||
|  | ||||
| @ -31,6 +31,7 @@ intermediate!( | ||||
| ); | ||||
| 
 | ||||
| impl IParagraph { | ||||
|     #[allow(clippy::needless_lifetimes)] | ||||
|     pub(crate) async fn artificial<'orig, 'parse>( | ||||
|         _intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, | ||||
|         children: Vec<IObject>, | ||||
| @ -50,19 +51,19 @@ impl IParagraph { | ||||
|             .children | ||||
|             .iter() | ||||
|             .filter(|c| match c { | ||||
|                 IObject::RegularLink(iregular_link) => match &iregular_link.target { | ||||
|                     super::LinkTarget::Image { src: _, alt: _ } => true, | ||||
|                     _ => false, | ||||
|                 }, | ||||
|                 IObject::RegularLink(iregular_link) => matches!( | ||||
|                     &iregular_link.target, | ||||
|                     super::LinkTarget::Image { src: _, alt: _ } | ||||
|                 ), | ||||
|                 _ => false, | ||||
|             }) | ||||
|             .count(); | ||||
|         num_images == 1 | ||||
|             && self.children.iter().all(|c| match c { | ||||
|                 IObject::RegularLink(iregular_link) => match &iregular_link.target { | ||||
|                     super::LinkTarget::Image { src: _, alt: _ } => true, | ||||
|                     _ => false, | ||||
|                 }, | ||||
|                 IObject::RegularLink(iregular_link) => matches!( | ||||
|                     &iregular_link.target, | ||||
|                     super::LinkTarget::Image { src: _, alt: _ } | ||||
|                 ), | ||||
|                 IObject::PlainText(iplain_text) => { | ||||
|                     iplain_text.source.chars().all(|c| c.is_ascii_whitespace()) | ||||
|                 } | ||||
|  | ||||
| @ -180,6 +180,7 @@ async fn convert_definition_contents<'orig, 'parse>( | ||||
| } | ||||
| 
 | ||||
| /// Take a footnote definition that has not yet received a reference and move it into the active footnotes.
 | ||||
| #[allow(clippy::needless_lifetimes)] | ||||
| pub(crate) async fn promote_footnote_definition<'orig, 'parse>( | ||||
|     intermediate_context: IntermediateContext<'orig, 'parse>, | ||||
|     label: &'parse str, | ||||
|  | ||||
| @ -186,7 +186,7 @@ impl LinkTarget { | ||||
|         if path.is_absolute() { | ||||
|             return Ok(format!("file://{}", input)); | ||||
|         } | ||||
|         return Ok(input.into_owned()); | ||||
|         Ok(input.into_owned()) | ||||
|     } | ||||
| 
 | ||||
|     /// Get file name from the last segment of an image path.
 | ||||
| @ -199,7 +199,7 @@ impl LinkTarget { | ||||
|         let path = Path::new(input.as_ref()); | ||||
|         match path | ||||
|             .components() | ||||
|             .last() | ||||
|             .next_back() | ||||
|             .ok_or("Images should have at least one component in their path.")? | ||||
|         { | ||||
|             std::path::Component::Prefix(_) => { | ||||
| @ -209,9 +209,7 @@ impl LinkTarget { | ||||
|             std::path::Component::RootDir | ||||
|             | std::path::Component::CurDir | ||||
|             | std::path::Component::ParentDir => { | ||||
|                 return Err( | ||||
|                     "Final component of an image path should be a normal component.".into(), | ||||
|                 ); | ||||
|                 Err("Final component of an image path should be a normal component.".into()) | ||||
|             } | ||||
|             std::path::Component::Normal(file_name) => Ok(file_name | ||||
|                 .to_str() | ||||
| @ -236,6 +234,7 @@ mod tests { | ||||
|         let registry = Registry::new(); | ||||
|         let registry = Arc::new(Mutex::new(registry)); | ||||
|         let intermediate_context = IntermediateContext::new(registry)?; | ||||
|         #[allow(clippy::single_element_loop)] | ||||
|         for (inp, typ) in [( | ||||
|             "https://test.example/foo", | ||||
|             LinkType::Protocol(Cow::from("https")), | ||||
|  | ||||
| @ -77,7 +77,7 @@ intermediate!( | ||||
|             .collect(); | ||||
|         let language = original.language.map(str::to_owned); | ||||
| 
 | ||||
|         match language.as_ref().map(String::as_str) { | ||||
|         match language.as_deref() { | ||||
|             Some(lang @ "bash") => { | ||||
|                 let highlighted = highlight_bash(&lines); | ||||
|                 if let Ok(highlighted) = highlighted { | ||||
| @ -151,7 +151,7 @@ where | ||||
|     std::string::String: for<'a> From<&'a L>, | ||||
| { | ||||
|     Ok(lines | ||||
|         .into_iter() | ||||
|         .iter() | ||||
|         .map(|l| { | ||||
|             let mut line = ISrcLine::new(); | ||||
|             line.children.push(ISrcSegment::RawText(l.into())); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander