Skip to content

Commit 36f5954

Browse files
committed
eliminate some clippy warnings for examples
1 parent 358db73 commit 36f5954

File tree

9 files changed

+10
-11
lines changed

9 files changed

+10
-11
lines changed

examples/src/body_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async fn echo_form(mut cx: Context<()>) -> EndpointResult {
3939
Ok(forms::form(msg))
4040
}
4141

42-
fn main() {
42+
pub fn main() {
4343
let mut app = App::new();
4444

4545
app.at("/echo/string").post(echo_string);

examples/src/catch_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tide::Context;
22

3-
pub async fn echo_path(cx: Context<()>) -> String {
3+
async fn echo_path(cx: Context<()>) -> String {
44
let path: String = cx.param("path").unwrap();
55
format!("Your path is: {}", path)
66
}

examples/src/cookies.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use cookie::Cookie;
22
use tide::{cookies::CookiesExt, middleware::CookiesMiddleware, Context};
33

44
/// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter.
5-
///
65
async fn retrieve_cookie(mut cx: Context<()>) -> String {
76
format!("hello cookies: {:?}", cx.get_cookie("hello").unwrap())
87
}
@@ -17,7 +16,7 @@ async fn remove_cookie(mut cx: Context<()>) {
1716
cx.remove_cookie(Cookie::named("hello")).unwrap();
1817
}
1918

20-
fn main() {
19+
pub fn main() {
2120
let mut app = tide::App::new();
2221
app.middleware(CookiesMiddleware::new());
2322

examples/src/default_headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tide::middleware::DefaultHeaders;
22

3-
fn main() {
3+
pub fn main() {
44
let mut app = tide::App::new();
55

66
app.middleware(

examples/src/graphql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async fn handle_graphql(mut cx: Context<Data>) -> EndpointResult {
5656
Ok(resp)
5757
}
5858

59-
fn main() {
59+
pub fn main() {
6060
let mut app = App::with_state(Data::default());
6161
app.at("/graphql").post(handle_graphql);
6262
app.serve("127.0.0.1:8000").unwrap();

examples/src/hello.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn main() {
1+
pub fn main() {
22
let mut app = tide::App::new();
33
app.at("/").get(async move |_| "Hello, world!");
44
app.serve("127.0.0.1:8000").unwrap();

examples/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(async_await)]
2-
#![allow(unused)]
32
#![warn(clippy::all)]
3+
#![allow(dead_code)]
44

55
mod body_types;
66
mod catch_all;

examples/src/messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async fn get_message(cx: Context<Database>) -> EndpointResult {
6464
}
6565
}
6666

67-
fn main() {
67+
pub fn main() {
6868
let mut app = App::with_state(Database::default());
6969
app.at("/message").post(new_message);
7070
app.at("/message/:id").get(get_message).post(set_message);

examples/src/staticfile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl StaticFile {
4242
// Check if the path exists and handle if it's a directory containing `index.html`
4343
if meta.is_some() && meta.as_ref().map(|m| !m.is_file()).unwrap_or(false) {
4444
// Redirect if path is a dir and URL doesn't end with "/"
45-
if !actual_path.ends_with("/") {
45+
if !actual_path.ends_with('/') {
4646
return Ok(response
4747
.status(StatusCode::MOVED_PERMANENTLY)
4848
.header(header::LOCATION, String::from(actual_path) + "/")
@@ -119,7 +119,7 @@ async fn handle_path(ctx: Context<StaticFile>) -> EndpointResult {
119119
})
120120
}
121121

122-
fn main() {
122+
pub fn main() {
123123
let mut app = App::with_state(StaticFile::new("./"));
124124
app.at("/*").get(handle_path);
125125
app.serve("127.0.0.1:8000").unwrap();

0 commit comments

Comments
 (0)