Skip to content

Commit

Permalink
Fix project warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Skittyblock committed Jul 4, 2024
1 parent 8f086a7 commit 24b6df8
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-unknown-unknown"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
*.wat
target/
*.wat
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = ["crates/*", "examples/*"]
resolver = "2"

[profile.dev]
panic = "abort"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lto = true
aidoku = "0.1.0"
```

Next, make a folder called .cargo and a file called "config". In it, put:
Next, make a folder called .cargo and a file called "config.toml". In it, put:
```toml
[build]
target = "wasm32-unknown-unknown"
Expand Down Expand Up @@ -62,7 +62,7 @@ fn get_chapter_list(_: String) -> Result<Vec<Chapter>> {
}

#[get_page_list]
fn get_page_list(_: String) -> Result<Vec<Page>> {
fn get_page_list(_: String, _: String) -> Result<Vec<Page>> {
todo!()
}
```
Expand Down
2 changes: 1 addition & 1 deletion crates/imports/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl Node {
}
}

/// Get an instance from a [Rid](crate::Rid)
/// Get an instance from a [Rid].
///
/// # Safety
/// Ensure that this Rid is of [Kind::Node](crate::Kind) before
Expand Down
2 changes: 1 addition & 1 deletion crates/imports/src/json.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Converts JSON to a [ValueRef](crate::std::ValueRef).
//! Converts JSON to a [ValueRef].
use crate::{
error::{AidokuError, AidokuErrorKind, Result},
std::{Rid, ValueRef},
Expand Down
2 changes: 1 addition & 1 deletion crates/imports/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Request {
}
}

/// Get the data as a [Node](crate::html::Node).
/// Get the data as a [Node].
pub fn html(self) -> Result<Node> {
self.send();
let rid = unsafe { request_html(self.0) };
Expand Down
10 changes: 5 additions & 5 deletions crates/imports/src/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ impl ValueRef {
///
/// # Arguments
/// * `format`: The date format, as compatible with
/// [NSDateFormatter](https://nsdateformatter.com/).
/// [NSDateFormatter](https://nsdateformatter.com/).
/// * `locale`: The locale identifier for this date string.
/// Also available on [NSDateFormatter](https://nsdateformatter.com/).
/// Also available on [NSDateFormatter](https://nsdateformatter.com/).
/// * `timezone`: The time zone for this date, as compatible with
/// [TimeZone](https://developer.apple.com/documentation/foundation/timezone).
/// They can be a [zoneinfo timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones),
/// or an [abbreviation](https://gist.github.com/mteece/80fff3329074cf90d7991e55f4fc8de4).
/// [TimeZone](https://developer.apple.com/documentation/foundation/timezone).
/// They can be a [zoneinfo timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones),
/// or an [abbreviation](https://gist.github.com/mteece/80fff3329074cf90d7991e55f4fc8de4).
pub fn as_date<T: Default + AsRef<str>>(
&self,
format: T,
Expand Down
25 changes: 10 additions & 15 deletions crates/lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#![doc = include_str!("../../../README.md")]
#![no_std]
#![feature(
core_intrinsics,
alloc_error_handler,
fmt_internals,
panic_info_message
)]
#![feature(alloc_error_handler)]

// Setup allocator

Expand Down Expand Up @@ -38,7 +33,7 @@ fn as_abort<T: AsRef<str>>(message: T, file: T, line: u32, column: u32) -> ! {
let message_ptr = message_len_ptr.add(1) as *mut u8;
copy::<u8>(message.as_ptr(), message_ptr, message.len());

let file_len_ptr = message_len_ptr.add(message.len()) as *mut i32;
let file_len_ptr = message_len_ptr.add(message.len());
*file_len_ptr = i32::try_from(file.len()).unwrap_or(-1);

let file_ptr = file_len_ptr.add(1) as *mut u8;
Expand All @@ -58,12 +53,11 @@ fn as_abort<T: AsRef<str>>(message: T, file: T, line: u32, column: u32) -> ! {
}
}

core::intrinsics::abort()
core::arch::wasm32::unreachable()
}

#[cfg_attr(not(test), panic_handler)]
pub fn panic_handle(info: &core::panic::PanicInfo) -> ! {
use aidoku_imports::Write;
let (file, line, col) = if let Some(location) = info.location() {
(location.file(), location.line(), location.column())
} else {
Expand All @@ -77,7 +71,7 @@ pub fn panic_handle(info: &core::panic::PanicInfo) -> ! {

#[cfg_attr(not(test), alloc_error_handler)]
pub fn alloc_error_handle(_: core::alloc::Layout) -> ! {
core::intrinsics::abort()
core::arch::wasm32::unreachable()
}

// Make things public
Expand All @@ -96,11 +90,12 @@ pub mod std {
pub use aidoku_imports::*;
pub use alloc::string::String;
pub use alloc::vec::Vec;
pub fn format(args: core::fmt::Arguments) -> crate::std::String {
let mut string = crate::std::String::with_capacity(args.estimated_capacity());
string.write_fmt(args).expect("error formatting string");
string
}

// pub fn format(args: core::fmt::Arguments) -> crate::std::String {
// let mut string = crate::std::String::with_capacity(args.estimated_capacity());
// string.write_fmt(args).expect("error formatting string");
// string
// }
}

/// The Aidoku prelude, which includes [format!](aidoku_macros::format),
Expand Down

0 comments on commit 24b6df8

Please sign in to comment.