forked from 1b-agent/opencadstudio-upstream
style: apply cargo fmt across workspace
This commit is contained in:
1 parent
85710e5454
commit
9cf9ff2c5c
531 files changed
+57740
-33906
No files matched your search
+9
-10
@@ -6,12 +6,10 @@
|
||||
//! Web builds read `discussions.json`, generated by the Pages workflow through
|
||||
//! GitHub's authenticated GraphQL API.
|
||||
|
||||
pub const DISCUSSIONS_URL: &str =
|
||||
"https://github.com/HakanSeven12/OpenCADStudio/discussions";
|
||||
pub const DISCUSSIONS_URL: &str = "https://github.com/HakanSeven12/OpenCADStudio/discussions";
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
const FEED_URL: &str =
|
||||
"https://github.com/HakanSeven12/OpenCADStudio/discussions.atom";
|
||||
const FEED_URL: &str = "https://github.com/HakanSeven12/OpenCADStudio/discussions.atom";
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct DiscussionEntry {
|
||||
@@ -108,9 +106,9 @@ fn parse_atom(feed: &str) -> Vec<DiscussionEntry> {
|
||||
.skip(1)
|
||||
.filter_map(|tail| {
|
||||
let entry = tail.split_once("</entry>")?.0;
|
||||
let url_start = entry.find(
|
||||
"href=\"https://github.com/HakanSeven12/OpenCADStudio/discussions/",
|
||||
)? + "href=\"".len();
|
||||
let url_start = entry
|
||||
.find("href=\"https://github.com/HakanSeven12/OpenCADStudio/discussions/")?
|
||||
+ "href=\"".len();
|
||||
let url_tail = &entry[url_start..];
|
||||
let url = url_tail.split_once('"')?.0.to_string();
|
||||
let number = url.rsplit('/').next()?.parse().ok()?;
|
||||
@@ -154,7 +152,9 @@ fn xml_text(block: &str, tag: &str) -> Option<String> {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn pinned_numbers(page: &str) -> std::collections::HashSet<u64> {
|
||||
let mut numbers = std::collections::HashSet::new();
|
||||
let Some(after_heading) = page.split_once("id=\"pinned-discussions\"").map(|(_, rest)| rest)
|
||||
let Some(after_heading) = page
|
||||
.split_once("id=\"pinned-discussions\"")
|
||||
.map(|(_, rest)| rest)
|
||||
else {
|
||||
return numbers;
|
||||
};
|
||||
@@ -187,8 +187,7 @@ pub async fn fetch_discussions_web() -> Result<Vec<DiscussionEntry>, String> {
|
||||
let response = JsFuture::from(window.fetch_with_str("discussions.json"))
|
||||
.await
|
||||
.map_err(|_| "fetch failed")?;
|
||||
let response: web_sys::Response =
|
||||
response.dyn_into().map_err(|_| "not a Response")?;
|
||||
let response: web_sys::Response = response.dyn_into().map_err(|_| "not a Response")?;
|
||||
if !response.ok() {
|
||||
return Err(format!("HTTP {}", response.status()));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user