Fix clippy warnings and Readme

This commit is contained in:
Dietrich 2021-06-17 10:45:28 +02:00 committed by Franz Dietrich
parent 7cb20cf8b1
commit 51276d3831
9 changed files with 18 additions and 15 deletions

View File

@ -75,9 +75,9 @@ clear = true
install_crate = { rustup_component_name = "clippy", binary = "cargo-clippy", test_arg = "--help" }
command = "cargo"
args = ["clippy", "--all-features", "--",
"--deny", "warnings",
"--deny", "clippy::pedantic",
"--deny", "clippy::nursery",
"--warn", "warnings",
"--warn", "clippy::pedantic",
"--warn", "clippy::nursery",
"--allow", "clippy::wildcard_imports", # for `use seed::{prelude::*, *};`
"--allow", "clippy::future_not_send", # JS/WASM is single threaded
"--allow", "clippy::used_underscore_binding", # some libraries break this rule

View File

@ -4,12 +4,11 @@ The target audience of this tool are small entities that need a url shortener. T
So in general this is more a shared short url bookmark webpage than a shorturl service.
![Screenshot](./doc/img/pslinkscreenshot.png)
![Screenshot](./doc/img/screenshot.png)
![Screenshot](./doc/img/screenshot_edit.png)
The Page comes with a basic commandline interface to setup the environment.
> This branch is under development the commands below are slightly different. To build use: `cargo make build` to use pslink use the `target/debug/pslink` file.
## Usage
### install binary
@ -33,7 +32,10 @@ Pslink can be compiled and installed with cargo. Setup cargo as guided here: htt
After that install pslink using:
```bash
$ cargo install pslink
$ cargo install cargo-make
$ cargo make build_release
# or
$ cargo make start_release
```
If that succeeds you should now be able to call pslink.
@ -43,10 +45,10 @@ If that succeeds you should now be able to call pslink.
When building manually with cargo you have to have a sqlite database present or build it in offline mode. So on your first build you will most likely need to call:
```bash
SQLX_OFFLINE=1 cargo run
SQLX_OFFLINE=1 cargo make build_release
# or
$ export SQLX_OFFLINE=1
$ cargo run
$ cargo make build_release
```
If pslink is built with `cargo build release --target=x86_64-unknown-linux-musl` everything is embedded and it should be portable to any 64bit linux system.

View File

@ -96,8 +96,8 @@ pub fn get_host() -> String {
}
/// The pages:
/// * Home for listing of links
/// * ListUsers for listing of users
/// * `Home` for listing of links
/// * `ListUsers` for listing of users
#[derive(Debug)]
enum Page {
Home(pages::list_links::Model),

View File

@ -250,8 +250,9 @@ pub fn process_user_edit_messages(
model.user_edit = None;
orders.send_msg(Msg::Query(UserQueryMsg::Fetch));
}
UserEditMsg::MakeAdmin(user) => update_privileges(user, orders),
UserEditMsg::MakeRegular(user) => update_privileges(user, orders),
UserEditMsg::MakeAdmin(user) | UserEditMsg::MakeRegular(user) => {
update_privileges(user, orders)
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

BIN
doc/img/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
doc/img/screenshot_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -210,7 +210,7 @@ async fn parse_args_to_config(config: ArgMatches<'_>) -> ServerConfig {
///
/// # Panics
/// This funcion panics if preconditions like the availability of the database are not met.
pub(crate) async fn setup() -> Result<Option<crate::ServerConfig>, ServerError> {
pub async fn setup() -> Result<Option<crate::ServerConfig>, ServerError> {
// load the environment .env file if available.
dotenv().ok();

View File

@ -53,7 +53,7 @@ impl From<Link> for LinkDelta {
}
impl From<FullLink> for LinkDelta {
/// Automatically create a `LinkDelta` from a FullLink.
/// Automatically create a `LinkDelta` from a `FullLink`.
fn from(l: FullLink) -> Self {
Self {
edit: EditMode::Edit,