summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-06 11:52:09 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-06 11:52:09 +0100
commitea8edfa821f059921550c45d4f0267160b638a04 (patch)
tree940c358e400e55bc1ba47faf7c1fa07611af5241 /src
parent0bb0f1c98fc8eff5d7556bbe9d5801f02237a5c0 (diff)
Make Rust happier about the inline documentation
Diffstat (limited to 'src')
-rw-r--r--src/geom/ratio.rs2
-rw-r--r--src/ide/highlight.rs2
-rw-r--r--src/lib.rs29
-rw-r--r--src/model/func.rs10
-rw-r--r--src/model/symbol.rs3
-rw-r--r--src/util/mod.rs2
6 files changed, 21 insertions, 27 deletions
diff --git a/src/geom/ratio.rs b/src/geom/ratio.rs
index 5c58649d..7be16ff8 100644
--- a/src/geom/ratio.rs
+++ b/src/geom/ratio.rs
@@ -3,7 +3,7 @@ use super::*;
/// A ratio of a whole.
///
/// _Note_: `50%` is represented as `0.5` here, but stored as `50.0` in the
-/// corresponding [literal](crate::syntax::ast::LitKind::Numeric).
+/// corresponding [literal](crate::syntax::ast::Numeric).
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Ratio(Scalar);
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index 53b56d7a..c12cb87a 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -1,6 +1,6 @@
use crate::syntax::{ast, LinkedNode, SyntaxKind, SyntaxNode};
-/// Syntax highlighting tag.
+/// A syntax highlighting tag.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Tag {
/// A line or block comment.
diff --git a/src/lib.rs b/src/lib.rs
index 0dc42152..1c399864 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,22 +1,25 @@
//! The compiler for the _Typst_ markup language.
//!
//! # Steps
-//! - **Parsing:** The compiler first transforms a plain string into an
-//! [iterator of tokens][tokens]. This token stream is [parsed] into a [syntax
-//! tree]. The tree itself is untyped, but the [AST] module provides a typed
-//! layer over it.
-//! - **Evaluation:** The next step is to [evaluate] the markup. This produces a
-//! [module], consisting of a scope of values that were exported by the code
-//! and [content], a hierarchical, styled representation of what was written
-//! in the source file. The nodes of the content tree are well structured and
+//! - **Parsing:**
+//! The compiler first transforms a plain string into an iterator of [tokens].
+//! This token stream is [parsed] into a [syntax tree]. The tree itself is
+//! untyped, but the [AST] module provides a typed layer over it.
+//! - **Evaluation:**
+//! The next step is to [evaluate] the markup. This produces a [module],
+//! consisting of a scope of values that were exported by the code and
+//! [content], a hierarchical, styled representation of what was written in
+//! the source file. The nodes of the content tree are well structured and
//! order-independent and thus much better suited for further processing than
//! the raw markup.
-//! - **Typesetting:** Next, the content is [typeset] into a [document]
-//! containing one [frame] per page with elements and fixed positions.
-//! - **Exporting:** These frames can finally be exported into an output format
-//! (currently supported are [PDF] and [raster images]).
+//! - **Typesetting:**
+//! Next, the content is [typeset] into a [document] containing one [frame]
+//! per page with elements and fixed positions.
+//! - **Exporting:**
+//! These frames can finally be exported into an output format (currently
+//! supported are [PDF] and [raster images]).
//!
-//! [tokens]: syntax::Tokens
+//! [tokens]: syntax::SyntaxKind
//! [parsed]: syntax::parse
//! [syntax tree]: syntax::SyntaxNode
//! [AST]: syntax::ast
diff --git a/src/model/func.rs b/src/model/func.rs
index 1ccb0107..c5bab64c 100644
--- a/src/model/func.rs
+++ b/src/model/func.rs
@@ -226,18 +226,14 @@ pub struct FuncInfo {
pub name: &'static str,
/// The display name of the function.
pub display: &'static str,
- /// Which category the function is part of.
- pub category: &'static str,
/// Documentation for the function.
pub docs: &'static str,
- /// The source code of an example, if any.
- pub example: Option<&'static str>,
- /// Documentation about this function's syntax, if it has syntax.
- pub syntax: Option<&'static str>,
/// Details about the function's parameters.
pub params: Vec<ParamInfo>,
/// Valid types for the return value.
pub returns: Vec<&'static str>,
+ /// Which category the function is part of.
+ pub category: &'static str,
}
impl FuncInfo {
@@ -254,8 +250,6 @@ pub struct ParamInfo {
pub name: &'static str,
/// Documentation for the parameter.
pub docs: &'static str,
- /// The source code of an example, if any.
- pub example: Option<&'static str>,
/// Valid values for the parameter.
pub cast: CastInfo,
/// Is the parameter positional?
diff --git a/src/model/symbol.rs b/src/model/symbol.rs
index 9d226801..16ab58af 100644
--- a/src/model/symbol.rs
+++ b/src/model/symbol.rs
@@ -6,7 +6,6 @@ use std::sync::Arc;
use crate::diag::StrResult;
use crate::util::EcoString;
-/// Define a list of symbols.
#[doc(inline)]
pub use typst_macros::symbols;
@@ -169,8 +168,6 @@ fn contained(modifiers: &str, m: &str) -> bool {
}
/// Normalize an accent to a combining one.
-///
-/// https://www.w3.org/TR/mathml-core/#combining-character-equivalences
pub fn combining_accent(c: char) -> Option<char> {
Some(match c {
'\u{0300}' | '`' => '\u{0300}',
diff --git a/src/util/mod.rs b/src/util/mod.rs
index 0b681223..b20dd053 100644
--- a/src/util/mod.rs
+++ b/src/util/mod.rs
@@ -37,7 +37,7 @@ where
}
/// Calculate a 128-bit siphash of a value.
-pub fn hash128<T: Hash>(value: &T) -> u128 {
+pub fn hash128<T: Hash + ?Sized>(value: &T) -> u128 {
let mut state = SipHasher::new();
value.hash(&mut state);
state.finish128().as_u128()