Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
eliknebel committed Sep 8, 2023
1 parent ace1ed6 commit 95e129b
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/docs/components/analog_clock.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ pub fn analog_clock(ctx: Context, _props: AnalogClockProps) {
)
}

external fn clock_time(Int) -> #(Int, Int, Int) =
"Elixir.FFIUtils" "clock_time"
@external(erlang, "Elixir.FFIUtils", "clock_time")
fn clock_time(a: Int) -> #(Int, Int, Int)
4 changes: 2 additions & 2 deletions src/docs/components/clock.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ pub fn clock(ctx: Context, props: ClockProps) {
)
}

pub external fn format_time(a, String) -> String =
"Elixir.FFIUtils" "format_time"
@external(erlang, "Elixir.FFIUtils", "format_time")
pub fn format_time(a: a, b: String) -> String
2 changes: 1 addition & 1 deletion src/docs/components/product_list.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import sprocket/internal/identifiable_callback.{CallbackFn}
import sprocket/html.{
button, button_text, div, div_text, h5_text, i, img, keyed, li, text, ul,
}
import sprocket/html/attributes.{alt, class, href, on_click, role, src}
import sprocket/html/attributes.{alt, class, on_click, role, src}

pub type Product {
Product(
Expand Down
8 changes: 4 additions & 4 deletions src/docs/log_requests.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ type TimeUnit {
Microsecond
}

external fn now() -> Int =
"erlang" "monotonic_time"
@external(erlang, "erlang", "monotonic_time")
fn now() -> Int

external fn convert_time_unit(Int, TimeUnit, TimeUnit) -> Int =
"erlang" "convert_time_unit"
@external(erlang, "erlang", "convert_time_unit")
fn convert_time_unit(a: Int, b: TimeUnit, c: TimeUnit) -> Int
4 changes: 2 additions & 2 deletions src/docs/static.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ pub fn middleware(service: Service(in, BitBuilder)) -> Service(in, BitBuilder) {
}
}

pub external fn priv_directory() -> String =
"sprocket_ffi" "priv_directory"
@external(erlang, "sprocket_ffi", "priv_directory")
pub fn priv_directory() -> String
8 changes: 4 additions & 4 deletions src/docs/utils/logger.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pub type Level {
/// Configure the Erlang logger to use the log level and output format that we
/// want, rather than the more verbose Erlang default format.
///
pub external fn configure_backend() -> Nil =
"sprocket_ffi" "configure_logger_backend"
@external(erlang, "sprocket_ffi", "configure_logger_backend")
pub fn configure_backend() -> Nil

external fn erlang_log(Level, String) -> Dynamic =
"logger" "log"
@external(erlang, "logger", "log")
fn erlang_log(a: Level, b: String) -> Dynamic

pub fn log(level: Level, message: String) -> Nil {
erlang_log(level, message)
Expand Down
2 changes: 1 addition & 1 deletion src/sprocket/cassette.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ fn handle_ws_message(
case sprocket.get_client_hook(sprocket, id) {
Ok(Client(_id, _name, handle_event)) -> {
// TODO: implement reply dispatcher
let reply_dispatcher = fn(event, payload) { todo }
let reply_dispatcher = fn(_event, _payload) { todo }

option.map(
handle_event,
Expand Down
8 changes: 4 additions & 4 deletions src/sprocket/internal/logger.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pub type Level {
/// Configure the Erlang logger to use the log level and output format that we
/// want, rather than the more verbose Erlang default format.
///
pub external fn configure_backend() -> Nil =
"sprocket_ffi" "configure_logger_backend"
@external(erlang, "sprocket_ffi", "configure_logger_backend")
pub fn configure_backend() -> Nil

external fn erlang_log(Level, String) -> Dynamic =
"logger" "log"
@external(erlang, "logger", "log")
fn erlang_log(a: Level, b: String) -> Dynamic

pub fn log(level: Level, message: String) -> Nil {
erlang_log(level, message)
Expand Down
2 changes: 1 addition & 1 deletion src/sprocket/internal/utils/ordered_map.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub fn find_next(m: OrderedMap(k, a), key: k) -> Result(a, Nil) {
[] -> Error(Nil)
[item, ..rest] ->
case item {
KeyedItem(k, v) ->
KeyedItem(k, _v) ->
case k == key {
True -> find_next_helper(rest)
False -> find_next(OrderedMap(rest, m.map, m.size), key)
Expand Down
2 changes: 1 addition & 1 deletion src/sprocket/internal/utils/sigils.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import gleam/map.{Map}
/// ```
/// let assert "Hello World!" = "Hello {name}!" |> s_strfmt({"name": "World"})
/// ```
pub fn s_strfmt(str: String, interpolations: Map(String, String)) {
pub fn s_strfmt(_str: String, _interpolations: Map(String, String)) {
todo
}
4 changes: 2 additions & 2 deletions src/sprocket/internal/utils/uuid.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ fn e(n: Int) -> Int {
}
}

external fn crypto_strong_rand_bytes(Int) -> BitString =
"crypto" "strong_rand_bytes"
@external(erlang, "crypto", "strong_rand_bytes")
fn crypto_strong_rand_bytes(a: Int) -> BitString
4 changes: 1 addition & 3 deletions test/sprocket/hooks/state_test.gleam
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import gleam/int
import gleam/string
import gleam/option.{None}
import gleeunit/should
import sprocket/context.{Context}
import sprocket/component.{component}
import sprocket/html.{button, text}
import sprocket/html/attributes.{id, on_click}
import sprocket/hooks.{OnMount, OnUpdate, WithDeps, dep}
import sprocket/hooks.{WithDeps, dep}
import sprocket/hooks/state.{state}
import sprocket/hooks/callback.{callback}
import sprocket/internal/identifiable_callback.{CallbackFn}
Expand Down

0 comments on commit 95e129b

Please sign in to comment.