Skip to content

Commit

Permalink
fix: clippy in rust 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Nov 29, 2024
1 parent a3150c2 commit 056e8b6
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion crates/conversion/typst2vec/src/pass/typst2vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct State<'a> {
pub size: ir::Size,
}

impl<'a> State<'a> {
impl State<'_> {
fn new(introspector: &Introspector, size: ir::Size) -> State {
State {
introspector,
Expand Down
8 changes: 4 additions & 4 deletions crates/conversion/vec2canvas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ pub struct CanvasRenderTask<'m, 't, Feat: ExportFeature> {
_feat_phantom: std::marker::PhantomData<&'t Feat>,
}

impl<'m, 't, Feat: ExportFeature> FontIndice<'m> for CanvasRenderTask<'m, 't, Feat> {
impl<'m, Feat: ExportFeature> FontIndice<'m> for CanvasRenderTask<'m, '_, Feat> {
fn get_font(&self, value: &FontRef) -> Option<&'m ir::FontItem> {
self.module.fonts.get(value.idx as usize)
}
}

impl<'m, 't, Feat: ExportFeature> GlyphFactory for CanvasRenderTask<'m, 't, Feat> {
impl<Feat: ExportFeature> GlyphFactory for CanvasRenderTask<'_, '_, Feat> {
fn get_glyph(&mut self, font: &FontItem, glyph: u32, fill: ImmutStr) -> Option<CanvasNode> {
let glyph_data = font.get_glyph(glyph)?;
Some(Arc::new(CanvasElem::Glyph(CanvasGlyphElem {
Expand All @@ -190,7 +190,7 @@ impl<'m, 't, Feat: ExportFeature> GlyphFactory for CanvasRenderTask<'m, 't, Feat
}
}

impl<'m, 't, Feat: ExportFeature> RenderVm<'m> for CanvasRenderTask<'m, 't, Feat> {
impl<'m, Feat: ExportFeature> RenderVm<'m> for CanvasRenderTask<'m, '_, Feat> {
// type Resultant = String;
type Resultant = CanvasNode;
type Group = CanvasStack;
Expand Down Expand Up @@ -385,7 +385,7 @@ impl<'a> CanvasStateGuard<'a> {
}
}

impl<'a> Drop for CanvasStateGuard<'a> {
impl Drop for CanvasStateGuard<'_> {
fn drop(&mut self) {
self.0.restore();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/conversion/vec2dom/src/incr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ pub struct DomContext<'m, 'a> {
pub module: &'m Module,
}

impl<'m, 'a> DomContext<'m, 'a> {
impl<'m> DomContext<'m, '_> {
pub fn create_stub(&self) -> Element {
self.stub.clone_node().unwrap().dyn_into().unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/conversion/vec2svg/src/backend/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<'a, E: Escapes> Escaped<'a, E> {
}
}

impl<'a, E: Escapes> fmt::Display for Escaped<'a, E> {
impl<E: Escapes> fmt::Display for Escaped<'_, E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut total_remaining = self.to_escape;

Expand Down
14 changes: 7 additions & 7 deletions crates/conversion/vec2svg/src/frontend/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct RenderContext<'m, 't, Feat: ExportFeature> {
pub _feat_phantom: std::marker::PhantomData<Feat>,
}

impl<'m, 't, Feat: ExportFeature> DynExportFeature for RenderContext<'m, 't, Feat> {
impl<Feat: ExportFeature> DynExportFeature for RenderContext<'_, '_, Feat> {
#[inline]
fn should_render_text_element(&self) -> bool {
Feat::SHOULD_RENDER_TEXT_ELEMENT && self.should_render_text_element
Expand All @@ -92,7 +92,7 @@ impl<'m, 't, Feat: ExportFeature> DynExportFeature for RenderContext<'m, 't, Fea
}
}

impl<'m, 't, Feat: ExportFeature> FontIndice<'m> for RenderContext<'m, 't, Feat> {
impl<'m, Feat: ExportFeature> FontIndice<'m> for RenderContext<'m, '_, Feat> {
fn get_font(&self, value: &FontRef) -> Option<&'m ir::FontItem> {
self.module.fonts.get(value.idx as usize).inspect(|e| {
// canary check
Expand All @@ -103,13 +103,13 @@ impl<'m, 't, Feat: ExportFeature> FontIndice<'m> for RenderContext<'m, 't, Feat>
}
}

impl<'m, 't, Feat: ExportFeature> BuildClipPath for RenderContext<'m, 't, Feat> {
impl<Feat: ExportFeature> BuildClipPath for RenderContext<'_, '_, Feat> {
fn build_clip_path(&mut self, path: &PathItem) -> Fingerprint {
self.fingerprint_builder.resolve(path)
}
}

impl<'m, 't, Feat: ExportFeature> NotifyPaint for RenderContext<'m, 't, Feat> {
impl<Feat: ExportFeature> NotifyPaint for RenderContext<'_, '_, Feat> {
fn notify_paint(&mut self, url_ref: ImmutStr) -> (u8, Fingerprint, Option<Transform>) {
if url_ref.starts_with("@g") {
let id = url_ref.trim_start_matches("@g");
Expand Down Expand Up @@ -162,7 +162,7 @@ impl<'m, 't, Feat: ExportFeature> NotifyPaint for RenderContext<'m, 't, Feat> {
}

/// Example of how to implement a FlatRenderVm.
impl<'m, 't, Feat: ExportFeature> RenderVm<'m> for RenderContext<'m, 't, Feat> {
impl<'m, Feat: ExportFeature> RenderVm<'m> for RenderContext<'m, '_, Feat> {
// type Resultant = String;
type Resultant = Arc<SvgTextNode>;
type Group = SvgTextBuilder;
Expand Down Expand Up @@ -207,9 +207,9 @@ impl<'m, 't, Feat: ExportFeature> RenderVm<'m> for RenderContext<'m, 't, Feat> {
}
}

impl<'m, 't, Feat: ExportFeature> IncrRenderVm<'m> for RenderContext<'m, 't, Feat> {}
impl<'m, Feat: ExportFeature> IncrRenderVm<'m> for RenderContext<'m, '_, Feat> {}

impl<'m, 't, Feat: ExportFeature> RenderContext<'m, 't, Feat> {
impl<Feat: ExportFeature> RenderContext<'_, '_, Feat> {
/// Render a text into the underlying context.
fn render_text_inplace(
&mut self,
Expand Down
4 changes: 2 additions & 2 deletions crates/reflexo-typst/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use typst::syntax::Span;

struct DiagMsgFmt<'a>(&'a TypstSourceDiagnostic);

impl<'a> fmt::Display for DiagMsgFmt<'a> {
impl fmt::Display for DiagMsgFmt<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.0.message)?;
if !self.0.hints.is_empty() {
Expand All @@ -27,7 +27,7 @@ impl<'a> fmt::Display for DiagMsgFmt<'a> {

struct PosFmt<'a>(&'a typst::diag::Tracepoint);

impl<'a> fmt::Display for PosFmt<'a> {
impl fmt::Display for PosFmt<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.0 {
typst::diag::Tracepoint::Call(Some(name)) => write!(f, "while calling {}", name),
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo-typst/src/exporter/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const VARIABLE: ansi_term::Color = ansi_term::Color::RGB(0x0f, 0x4b, 0x6e);
const FUNCTION: ansi_term::Color = ansi_term::Color::RGB(0x7a, 0xa2, 0xf7);
const MARKED: ansi_term::Color = ansi_term::Color::RGB(0x7d, 0xcf, 0xff);

impl<'a, W: io::Write> AstWriter<'a, W> {
impl<W: io::Write> AstWriter<'_, W> {
fn write_num_repr<T: Display>(&mut self, sk: SyntaxKind, ast: T) -> Option<()> {
self.painted(NUMBER, format!("Num({:?}, {})", sk, ast));
Some(())
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo-typst/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl CompileReport {

pub struct CompileReportMsg<'a>(&'a CompileReport);

impl<'a> fmt::Display for CompileReportMsg<'a> {
impl fmt::Display for CompileReportMsg<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use CompileReport::*;

Expand Down
6 changes: 3 additions & 3 deletions crates/reflexo-world/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ pub struct Revising<'a, T> {
pub inner: &'a mut T,
}

impl<'a, T> std::ops::Deref for Revising<'a, T> {
impl<T> std::ops::Deref for Revising<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
self.inner
}
}

impl<'a, T> std::ops::DerefMut for Revising<'a, T> {
impl<T> std::ops::DerefMut for Revising<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner
}
}

impl<'a, F: CompilerFeat> Revising<'a, CompilerUniverse<F>> {
impl<F: CompilerFeat> Revising<'_, CompilerUniverse<F>> {
pub fn vfs(&mut self) -> &mut Vfs<F::AccessModel> {
&mut self.inner.vfs
}
Expand Down

0 comments on commit 056e8b6

Please sign in to comment.