remove dependency on nightly

This commit is contained in:
mat 2024-01-21 22:30:25 -06:00
parent cae88a20ff
commit bf4db99465
7 changed files with 9 additions and 8 deletions

1
Cargo.lock generated
View File

@ -937,6 +937,7 @@ dependencies = [
"fend-core",
"futures",
"html-escape",
"once_cell",
"rand",
"regex",
"reqwest",

View File

@ -23,6 +23,7 @@ eyre = "0.6.11"
fend-core = "1.3.3"
futures = "0.3.29"
html-escape = "0.2.13"
once_cell = "1.19.0"
rand = "0.8.5"
regex = "1.10.2"
reqwest = { version = "0.11.23", default-features = false, features = [

View File

@ -1,6 +1,7 @@
use std::{cell::Cell, sync::LazyLock};
use std::cell::Cell;
use fend_core::SpanKind;
use once_cell::sync::Lazy;
use crate::engines::EngineResponse;
@ -96,7 +97,7 @@ fn evaluate(query: &str, html: bool) -> Option<String> {
Some(result_html)
}
pub static FEND_CONTEXT: LazyLock<fend_core::Context> = LazyLock::new(|| {
pub static FEND_CONTEXT: Lazy<fend_core::Context> = Lazy::new(|| {
let mut context = fend_core::Context::new();
// make lowercase f and c work

View File

@ -4,11 +4,11 @@ use std::{
net::IpAddr,
ops::Deref,
str::FromStr,
sync::LazyLock,
time::Instant,
};
use futures::future::join_all;
use once_cell::sync::Lazy;
use reqwest::header::HeaderMap;
use tokio::sync::mpsc;
@ -400,7 +400,7 @@ pub async fn autocomplete_with_engines(
Ok(merge_autocomplete_responses(autocomplete_results))
}
pub static CLIENT: LazyLock<reqwest::Client> = LazyLock::new(|| {
pub static CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
reqwest::ClientBuilder::new()
.local_address(IpAddr::from_str("0.0.0.0").unwrap())
// we pretend to be a normal browser so websites don't block us

View File

@ -48,7 +48,7 @@ pub fn parse_response(body: &str) -> Option<String> {
.url_relative(ammonia::UrlRelative::RewriteWithBase(
Url::parse("https://github.com").unwrap(),
))
.clean(&readme_html)
.clean(readme_html)
.to_string();
let readme_dom = Html::parse_fragment(&readme_html);

View File

@ -19,7 +19,7 @@ pub fn request(query: &str) -> RequestResponse {
"https://search.marginalia.nu/search",
&[
("query", query),
("profile", "default"),
("profile", "corpo"),
("js", "default"),
("adtech", "default"),
],

View File

@ -1,5 +1,3 @@
#![feature(lazy_cell)]
pub mod engines;
pub mod normalize;
pub mod parse;