aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-08-16 19:03:22 -0700
committerFuwn <[email protected]>2022-08-16 19:03:22 -0700
commit7c5662db552b9c4e8a1578eb917047980511ccc3 (patch)
tree66904d8af52d2e84aa44df800a81e39c75007eb8
parentfix(main.rs): github actions build error (diff)
downloadlocus-7c5662db552b9c4e8a1578eb917047980511ccc3.tar.xz
locus-7c5662db552b9c4e8a1578eb917047980511ccc3.zip
fix: bump toolchain for github actions
-rw-r--r--.github/workflows/check.yaml2
-rw-r--r--Dockerfile4
-rw-r--r--rust-toolchain.toml2
-rw-r--r--src/modules/search.rs46
-rw-r--r--src/xml.rs11
5 files changed, 38 insertions, 27 deletions
diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
index a324e2a..a9d6651 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/check.yaml
@@ -24,7 +24,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
- toolchain: nightly-2022-04-16
+ toolchain: nightly-2022-05-18
components: rustfmt, clippy
override: true
diff --git a/Dockerfile b/Dockerfile
index 072a4e8..799313d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
-FROM clux/muslrust:nightly-2022-04-16 AS environment
+FROM clux/muslrust:nightly-2022-05-18 AS environment
-ENV CHANNEL=nightly-2022-04-16
+ENV CHANNEL=nightly-2022-05-18
RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VER}/${RUST_ARCH}/rustup-init" -o rustup-init \
&& chmod +x rustup-init \
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 8905c53..b414bd5 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,2 +1,2 @@
[toolchain]
-channel = "nightly-2022-04-16"
+channel = "nightly-2022-05-18"
diff --git a/src/modules/search.rs b/src/modules/search.rs
index 61207d0..2179215 100644
--- a/src/modules/search.rs
+++ b/src/modules/search.rs
@@ -16,7 +16,7 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-use std::{lazy::SyncLazy, sync::Mutex};
+use std::{fmt::Write, lazy::SyncLazy, sync::Mutex};
use tantivy::schema;
use tempfile::TempDir;
@@ -104,13 +104,14 @@ pub(super) fn module(router: &mut windmark::Router) {
.unwrap()
.as_text()
.unwrap()
- }};
- ($document:ident, $field:ident) => {{
- $document.get_first($field).unwrap().as_text().unwrap()
- }};
+ }}; /* ($document:ident, $field:ident) => {{
+ * $document.get_first($field).unwrap().as_text().
+ * unwrap() }}; */
}
- results +=
+ let _ = write!(
+ results,
+ "{}",
&format!("=> {} {}{}\n", text!(path), text!(description), {
let mut lines = retrieved_document
.get_first(content)
@@ -135,22 +136,27 @@ pub(super) fn module(router: &mut windmark::Router) {
)
},
)
- });
+ })
+ );
}
- response += &format!(
- "\n\nYou searched for \"{}\"!\n\n## RESULTS\n\n{}\n\nIn need of \
- more results? This search engine populates its index with route \
- paths and route descriptions on startup. However, route content \
- isn't populated until the route is first visited. After a \
- route's first visit, it is updated after every five minutes, at \
- time of visit.",
- query.0,
- if results.is_empty() {
- "There are no results for your query...".to_string()
- } else {
- results.trim_end().to_string()
- },
+ let _ = write!(
+ response,
+ "{}",
+ &format!(
+ "\n\nYou searched for \"{}\"!\n\n## RESULTS\n\n{}\n\nIn need of \
+ more results? This search engine populates its index with \
+ route paths and route descriptions on startup. However, route \
+ content isn't populated until the route is first visited. \
+ After a route's first visit, it is updated after every five \
+ minutes, at time of visit.",
+ query.0,
+ if results.is_empty() {
+ "There are no results for your query...".to_string()
+ } else {
+ results.trim_end().to_string()
+ },
+ )
);
}
}
diff --git a/src/xml.rs b/src/xml.rs
index 0709723..b18d1dd 100644
--- a/src/xml.rs
+++ b/src/xml.rs
@@ -16,7 +16,10 @@
// Copyright (C) 2022-2022 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-use std::{collections::HashMap, fmt::Display};
+use std::{
+ collections::HashMap,
+ fmt::{Display, Write},
+};
pub struct Item {
fields: HashMap<String, String>,
@@ -40,7 +43,8 @@ impl Display for Item {
f,
"<item>{}</item>",
self.fields.iter().fold(String::new(), |mut acc, (k, v)| {
- acc.push_str(&format!("<{}>{}</{}>", k, v, k));
+ let _ = write!(acc, "<{}>{}</{}>", k, v, k);
+
acc
})
)
@@ -88,7 +92,8 @@ impl Display for Writer {
version=\"2.0\"><channel>{}<atom:link href=\"{}\" rel=\"self\" \
type=\"application/rss+xml\" />{}</channel></rss>",
self.fields.iter().fold(String::new(), |mut acc, (k, v)| {
- acc.push_str(&format!("<{}>{}</{}>", k, v, k));
+ let _ = write!(acc, "<{}>{}</{}>", k, v, k);
+
acc
}),
self.link,