diff options
| author | Marek Barvíř <barvirm@gmail.com> | 2023-04-18 11:19:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 11:19:09 +0200 |
| commit | 56673bcdf5a8be0f89a3781a5ce392736823dc44 (patch) | |
| tree | 03cbe32d6b1334bc17639b15f91b6d81b6a6e594 | |
| parent | 213502721961854b30a4971b0197495145fbbc75 (diff) | |
Clippy fixes (#856)
| -rw-r--r-- | library/src/compute/calc.rs | 2 | ||||
| -rw-r--r-- | library/src/layout/par.rs | 3 | ||||
| -rw-r--r-- | library/src/lib.rs | 1 | ||||
| -rw-r--r-- | src/eval/mod.rs | 2 | ||||
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | src/syntax/ast.rs | 2 |
6 files changed, 7 insertions, 4 deletions
diff --git a/library/src/compute/calc.rs b/library/src/compute/calc.rs index 35e7ddb8..9ab18dbf 100644 --- a/library/src/compute/calc.rs +++ b/library/src/compute/calc.rs @@ -467,7 +467,7 @@ pub fn perm( numbers: u64, ) -> Value { // By convention. - if base + 1 <= numbers { + if base < numbers { return Ok(Value::Int(0)); } diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 29a82a01..8bede473 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -506,6 +506,7 @@ impl<'a> Line<'a> { /// Collect all text of the paragraph into one string. This also performs /// string-level preprocessing like case transformations. +#[allow(clippy::type_complexity)] fn collect<'a>( children: &'a [Content], styles: &'a StyleChain<'a>, @@ -715,7 +716,7 @@ fn shape_range<'a>( let mut cursor = range.start; // Group by embedding level and script. - for i in cursor..range.end { + for i in range.clone() { if !bidi.text.is_char_boundary(i) { continue; } diff --git a/library/src/lib.rs b/library/src/lib.rs index ccdf448c..fa8cec80 100644 --- a/library/src/lib.rs +++ b/library/src/lib.rs @@ -1,4 +1,5 @@ #![allow(clippy::wildcard_in_or_patterns)] +#![allow(clippy::comparison_chain)] //! Typst's standard library. pub mod compute; diff --git a/src/eval/mod.rs b/src/eval/mod.rs index b8220112..797e1fef 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -1203,7 +1203,7 @@ impl ast::Pattern { return None; }; if let Some(ident) = ident { - vm.define(ident.clone(), sink); + vm.define(ident, sink); } i += sink_size as i64; Some(()) @@ -1,3 +1,4 @@ +#![allow(clippy::comparison_chain)] //! The compiler for the _Typst_ markup language. //! //! # Steps diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 3c01bdff..caf5319f 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -1625,7 +1625,7 @@ impl Destructuring { // Returns a list of all identifiers in the pattern. pub fn idents(&self) -> impl Iterator<Item = Ident> + '_ { - self.bindings().into_iter().filter_map(|binding| match binding { + self.bindings().filter_map(|binding| match binding { DestructuringKind::Ident(ident) => Some(ident), DestructuringKind::Sink(ident) => ident, DestructuringKind::Named(_, ident) => Some(ident), |
