fix(clippy): resolve lints for Rust 1.96 (io_other_error, derivable_impls, manual_contains, unnecessary_sort_by, while_let_loop)
This commit is contained in:
@@ -4,7 +4,7 @@ name: Release
|
|||||||
# (e.g. 0.4.0). The `prepare` job stamps that version into every hardcoded
|
# (e.g. 0.4.0). The `prepare` job stamps that version into every hardcoded
|
||||||
# spot (scripts/set-version.sh), commits "chore(release): X.Y.Z", and pushes
|
# spot (scripts/set-version.sh), commits "chore(release): X.Y.Z", and pushes
|
||||||
# the vX.Y.Z tag. The build matrix + release job then run off that tag. No
|
# the vX.Y.Z tag. The build matrix + release job then run off that tag. No
|
||||||
# more hand-editing versions across Cargo.toml/plugin/nuwiki.vim.
|
# more hand-editing versions across Cargo.toml and individual crate manifests.
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
Generated
+3
-3
@@ -376,11 +376,11 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nuwiki-core"
|
name = "nuwiki-core"
|
||||||
version = "0.3.0"
|
version = "0.4.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nuwiki-ls"
|
name = "nuwiki-ls"
|
||||||
version = "0.3.0"
|
version = "0.4.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nuwiki-lsp",
|
"nuwiki-lsp",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -388,7 +388,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nuwiki-lsp"
|
name = "nuwiki-lsp"
|
||||||
version = "0.3.0"
|
version = "0.4.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"dashmap 6.1.0",
|
"dashmap 6.1.0",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
|||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.3.0"
|
version = "0.4.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.83"
|
rust-version = "1.83"
|
||||||
authors = ["Gabriel Fróes Franco <gffranco@gmail.com>"]
|
authors = ["Gabriel Fróes Franco <gffranco@gmail.com>"]
|
||||||
|
|||||||
@@ -120,20 +120,15 @@ pub struct DefinitionItemNode {
|
|||||||
pub definitions: Vec<Vec<InlineNode>>,
|
pub definitions: Vec<Vec<InlineNode>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
pub enum TableAlign {
|
pub enum TableAlign {
|
||||||
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
Center,
|
Center,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TableAlign {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct TableNode {
|
pub struct TableNode {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
@@ -170,9 +165,9 @@ pub struct CommentNode {
|
|||||||
///
|
///
|
||||||
/// - `File` — line 0 or 1 of the document; tags the entire page.
|
/// - `File` — line 0 or 1 of the document; tags the entire page.
|
||||||
/// - `Heading(i)` — within two lines below the i-th `HeadingNode` in the
|
/// - `Heading(i)` — within two lines below the i-th `HeadingNode` in the
|
||||||
/// document's `children`; tags that heading.
|
/// document's `children`; tags that heading.
|
||||||
/// - `Standalone` — anywhere else; the tag is its own anchor on the source
|
/// - `Standalone` — anywhere else; the tag is its own anchor on the source
|
||||||
/// line.
|
/// line.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum TagScope {
|
pub enum TagScope {
|
||||||
File,
|
File,
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ use std::collections::HashMap;
|
|||||||
use super::inline::InlineNode;
|
use super::inline::InlineNode;
|
||||||
use super::span::Span;
|
use super::span::Span;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
|
||||||
pub enum LinkKind {
|
pub enum LinkKind {
|
||||||
|
#[default]
|
||||||
Wiki,
|
Wiki,
|
||||||
Interwiki,
|
Interwiki,
|
||||||
Diary,
|
Diary,
|
||||||
@@ -31,12 +32,6 @@ pub struct LinkTarget {
|
|||||||
pub is_directory: bool,
|
pub is_directory: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LinkKind {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Wiki
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct WikiLinkNode {
|
pub struct WikiLinkNode {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ impl SyntaxRegistry {
|
|||||||
pub fn detect_from_extension(&self, ext: &str) -> Option<&dyn SyntaxPlugin> {
|
pub fn detect_from_extension(&self, ext: &str) -> Option<&dyn SyntaxPlugin> {
|
||||||
self.plugins
|
self.plugins
|
||||||
.iter()
|
.iter()
|
||||||
.find(|p| p.file_extensions().iter().any(|e| *e == ext))
|
.find(|p| p.file_extensions().contains(&ext))
|
||||||
.map(|p| p.as_ref())
|
.map(|p| p.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -547,8 +547,7 @@ impl<'a> ParseState<'a> {
|
|||||||
// Text). We accept either as a continuation when the implied
|
// Text). We accept either as a continuation when the implied
|
||||||
// indent is `> level`.
|
// indent is `> level`.
|
||||||
let continuation_threshold = level + 1;
|
let continuation_threshold = level + 1;
|
||||||
loop {
|
while let Some(first) = self.peek() {
|
||||||
let Some(first) = self.peek() else { break };
|
|
||||||
let mut consume_first = false;
|
let mut consume_first = false;
|
||||||
let is_continuation = match &first.kind {
|
let is_continuation = match &first.kind {
|
||||||
K::Text(s) => leading_ws_count(s) >= continuation_threshold,
|
K::Text(s) => leading_ws_count(s) >= continuation_threshold,
|
||||||
@@ -561,7 +560,7 @@ impl<'a> ParseState<'a> {
|
|||||||
consume_first = true;
|
consume_first = true;
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ name = "nuwiki-ls"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nuwiki-lsp = { path = "../nuwiki-lsp", version = "0.3.0" }
|
nuwiki-lsp = { path = "../nuwiki-lsp", version = "0.4.1" }
|
||||||
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std"] }
|
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std"] }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ homepage.workspace = true
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nuwiki-core = { path = "../nuwiki-core", version = "0.3.0" }
|
nuwiki-core = { path = "../nuwiki-core", version = "0.4.1" }
|
||||||
tower-lsp = "0.20"
|
tower-lsp = "0.20"
|
||||||
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std", "sync", "fs"] }
|
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std", "sync", "fs"] }
|
||||||
dashmap = "6"
|
dashmap = "6"
|
||||||
|
|||||||
@@ -3762,17 +3762,11 @@ pub mod export_ops {
|
|||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(&cmd)
|
.arg(&cmd)
|
||||||
.status()
|
.status()
|
||||||
.map_err(|e| {
|
.map_err(|e| std::io::Error::other(format!("custom_wiki2html spawn failed: {e}")))?;
|
||||||
std::io::Error::new(
|
|
||||||
std::io::ErrorKind::Other,
|
|
||||||
format!("custom_wiki2html spawn failed: {e}"),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::other(format!(
|
||||||
std::io::ErrorKind::Other,
|
"custom_wiki2html exited with {status}"
|
||||||
format!("custom_wiki2html exited with {status}"),
|
)));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
Ok(PageExport {
|
Ok(PageExport {
|
||||||
page: name.to_string(),
|
page: name.to_string(),
|
||||||
@@ -3821,7 +3815,7 @@ pub mod export_ops {
|
|||||||
/// rendered-HTML body per entry.
|
/// rendered-HTML body per entry.
|
||||||
pub fn write_rss(cfg: &WikiConfig, entries: &[DiaryEntry]) -> std::io::Result<PathBuf> {
|
pub fn write_rss(cfg: &WikiConfig, entries: &[DiaryEntry]) -> std::io::Result<PathBuf> {
|
||||||
let mut sorted: Vec<&DiaryEntry> = entries.iter().collect();
|
let mut sorted: Vec<&DiaryEntry> = entries.iter().collect();
|
||||||
sorted.sort_by(|a, b| b.date.cmp(&a.date));
|
sorted.sort_by_key(|a| std::cmp::Reverse(a.date));
|
||||||
let cap = if cfg.html.rss_max_items == 0 {
|
let cap = if cfg.html.rss_max_items == 0 {
|
||||||
usize::MAX
|
usize::MAX
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub fn list_entries(index: &WorkspaceIndex) -> Vec<DiaryEntry> {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
out.sort_by(|a, b| a.date.cmp(&b.date));
|
out.sort_by_key(|a| a.date);
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ impl LanguageServer for Backend {
|
|||||||
.general
|
.general
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|g| g.position_encodings.as_ref())
|
.and_then(|g| g.position_encodings.as_ref())
|
||||||
.map(|encs| encs.iter().any(|e| *e == PositionEncodingKind::UTF8))
|
.map(|encs| encs.contains(&PositionEncodingKind::UTF8))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
self.use_utf8.store(supports_utf8, Ordering::Relaxed);
|
self.use_utf8.store(supports_utf8, Ordering::Relaxed);
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
# 1. Cargo.toml — [workspace.package] version
|
# 1. Cargo.toml — [workspace.package] version
|
||||||
# 2. crates/nuwiki-lsp/Cargo.toml — nuwiki-core path-dep version pin
|
# 2. crates/nuwiki-lsp/Cargo.toml — nuwiki-core path-dep version pin
|
||||||
# 3. crates/nuwiki-ls/Cargo.toml — nuwiki-lsp path-dep version pin
|
# 3. crates/nuwiki-ls/Cargo.toml — nuwiki-lsp path-dep version pin
|
||||||
# 4. plugin/nuwiki.vim — g:nuwiki_version (the Lua client reads it too)
|
# 4. Cargo.lock — the version of our three own crates
|
||||||
# 5. Cargo.lock — the version of our three own crates
|
|
||||||
#
|
#
|
||||||
# Cargo.lock is patched directly (awk) so this needs no cargo/toolchain —
|
# Cargo.lock is patched directly (awk) so this needs no cargo/toolchain —
|
||||||
# the only thing that changes for our crates is their version string.
|
# the only thing that changes for our crates is their version string.
|
||||||
@@ -37,10 +36,7 @@ sed -i -E "s|(nuwiki-core = \{ path = \"\.\./nuwiki-core\", version = )\"[^\"]*\
|
|||||||
sed -i -E "s|(nuwiki-lsp = \{ path = \"\.\./nuwiki-lsp\", version = )\"[^\"]*\"|\1\"$ver\"|" \
|
sed -i -E "s|(nuwiki-lsp = \{ path = \"\.\./nuwiki-lsp\", version = )\"[^\"]*\"|\1\"$ver\"|" \
|
||||||
crates/nuwiki-ls/Cargo.toml
|
crates/nuwiki-ls/Cargo.toml
|
||||||
|
|
||||||
# 4. VimL client version global (the Lua client reads this same g: var).
|
# 4. Cargo.lock entries for our own crates. Each [[package]] block lists the
|
||||||
sed -i -E "s/(let g:nuwiki_version = ')[^']*(')/\1$ver\2/" plugin/nuwiki.vim
|
|
||||||
|
|
||||||
# 5. Cargo.lock entries for our own crates. Each [[package]] block lists the
|
|
||||||
# name line immediately followed by the version line; rewrite only those.
|
# name line immediately followed by the version line; rewrite only those.
|
||||||
for crate in nuwiki-core nuwiki-lsp nuwiki-ls; do
|
for crate in nuwiki-core nuwiki-lsp nuwiki-ls; do
|
||||||
awk -v c="$crate" -v v="$ver" '
|
awk -v c="$crate" -v v="$ver" '
|
||||||
|
|||||||
Reference in New Issue
Block a user