actually make clippy happy

This commit is contained in:
Adrian Wannenmacher 2023-04-12 20:19:01 +02:00
parent 2f3bb4d6d5
commit 90c7e22f8b
No known key found for this signature in database
GPG key ID: 19D986ECB1E492D5
9 changed files with 47 additions and 47 deletions

View file

@ -20,7 +20,7 @@ pub struct Client {
type ClientContext = Arc<Mutex<Vec<Client>>>;
fn App(cx: Scope) -> Element {
use_router(cx, &|| RouterConfiguration::default(), &|| {
use_router(cx, &RouterConfiguration::default, &|| {
Segment::content(comp(ClientList))
.fixed(
"new",
@ -32,7 +32,7 @@ fn App(cx: Scope) -> Element {
)
});
use_context_provider::<ClientContext>(&cx, Default::default);
use_context_provider::<ClientContext>(cx, Default::default);
render! {
link {
@ -86,11 +86,11 @@ fn ClientList(cx: Scope) -> Element {
struct ClientAddName;
fn ClientAdd(cx: Scope) -> Element {
let clients = use_context::<ClientContext>(cx).unwrap();
let first_name = use_state(&cx, String::new);
let last_name = use_state(&cx, String::new);
let description = use_state(&cx, String::new);
let first_name = use_state(cx, String::new);
let last_name = use_state(cx, String::new);
let description = use_state(cx, String::new);
let navigator = use_navigate(&cx).unwrap();
let navigator = use_navigate(cx).unwrap();
cx.render(rsx! {
h2 { "Add new Client" }
@ -178,7 +178,7 @@ fn ClientAdd(cx: Scope) -> Element {
struct SettingsName;
fn Settings(cx: Scope) -> Element {
let clients = use_context::<ClientContext>(&cx).unwrap();
let clients = use_context::<ClientContext>(cx).unwrap();
cx.render(rsx! {
h2 { "Settings" }

View file

@ -17,7 +17,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
use_router(cx, &|| RouterConfiguration::default(), &|| {
use_router(cx, &RouterConfiguration::default, &|| {
Segment::content(comp(Home))
.fixed("games", comp(Games))
.fixed("play", comp(Play))

View file

@ -8,7 +8,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
use_router(cx, &|| RouterConfiguration::default(), &|| {
use_router(cx, &RouterConfiguration::default, &|| {
Segment::content(comp(Home)).fixed("settings", comp(Settings))
});

View file

@ -8,7 +8,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
use_router(cx, &|| RouterConfiguration::default(), &|| {
use_router(cx, &RouterConfiguration::default, &|| {
Segment::content(comp(Home))
.fixed(
"users",
@ -79,7 +79,7 @@ fn User(cx: Scope) -> Element {
let user = state.parameter::<UserId>().unwrap();
let query = state.query.as_ref().map(|q| q.clone()).unwrap_or_default();
let query = state.query.as_ref().cloned().unwrap_or_default();
let bold = query.contains("bold") && !query.contains("bold=false");
cx.render(rsx! {

View file

@ -14,7 +14,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
use_router(cx, &|| RouterConfiguration::default(), &|| {
use_router(cx, &RouterConfiguration::default, &|| {
Segment::content(comp(Home))
.fixed(
"blog",

View file

@ -590,8 +590,8 @@ mod tests {
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.query, Some(String::from("test=value")));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
assert_eq!(s.names, state.name_map);
}
@ -599,7 +599,7 @@ mod tests {
fn update_routing_root_index() {
let (mut s, _, _) = RouterService::<_, u8>::new(
test_segment(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -619,8 +619,8 @@ mod tests {
assert_eq!(state.path, String::from("/"));
assert!(state.query.is_none());
assert!(state.prefix.is_none());
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -645,8 +645,8 @@ mod tests {
});
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -699,7 +699,7 @@ mod tests {
let (mut s, _, _) = RouterService::<_, u8>::new(
Segment::empty(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(move |id| {
ids2.lock().unwrap().push(id);
}),
@ -727,7 +727,7 @@ mod tests {
fn push_internal() {
let (mut s, _, _) = RouterService::<_, u8>::new(
test_segment(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -746,15 +746,15 @@ mod tests {
});
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, true);
assert_eq!(state.can_go_forward, false);
assert!(state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
fn push_named() {
let (mut s, _, _) = RouterService::<_, u8>::new(
test_segment(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -773,8 +773,8 @@ mod tests {
});
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, true);
assert_eq!(state.can_go_forward, false);
assert!(state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -811,15 +811,15 @@ mod tests {
r
});
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
fn replace_named() {
let (mut s, _, _) = RouterService::<_, u8>::new(
test_segment(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -838,15 +838,15 @@ mod tests {
});
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
fn replace_internal() {
let (mut s, _, _) = RouterService::<_, u8>::new(
test_segment(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -865,8 +865,8 @@ mod tests {
});
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -903,15 +903,15 @@ mod tests {
r
});
assert_eq!(state.path, String::from("/fixed"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
fn subscribe() {
let (mut s, _, _) = RouterService::<_, u8>::new(
Segment::empty(),
Box::new(MemoryHistory::default()),
Box::<MemoryHistory>::default(),
Arc::new(|_| {}),
None,
ContentAtom("external target"),
@ -982,8 +982,8 @@ mod tests {
r
});
assert_eq!(state.path, String::from("/%F0%9F%A5%B3"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -1006,8 +1006,8 @@ mod tests {
assert!(state.names.is_empty());
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/%F0%9F%8E%BA"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
#[test]
@ -1078,7 +1078,7 @@ mod tests {
assert_eq!(state.path, String::from("/"));
assert!(state.query.is_none());
assert_eq!(state.prefix, Some(String::from("/prefix")));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, false);
assert!(!state.can_go_back);
assert!(!state.can_go_forward);
}
}

View file

@ -252,8 +252,8 @@ mod tests {
assert!(state.names.is_empty());
assert!(state.parameters.is_empty());
assert_eq!(state.path, String::from("/"));
assert_eq!(state.can_go_back, false);
assert_eq!(state.can_go_forward, true);
assert!(!state.can_go_back);
assert!(state.can_go_forward);
}
#[test]

View file

@ -12,7 +12,7 @@ fn main() {
fn App(cx: Scope) -> Element {
use_router(
&cx,
cx,
&|| {
#[cfg(not(feature = "web"))]
let history = MemoryHistory::default();

View file

@ -14,7 +14,7 @@ fn prepare(link: Component) -> String {
}
impl PartialEq for AppProps {
fn eq(&self, other: &Self) -> bool {
fn eq(&self, _other: &Self) -> bool {
false
}
}