Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Added host, port (with default value) variables using cli program mode #3

Merged
merged 2 commits into from Jul 30, 2019

Conversation

vladdancer
Copy link
Contributor

No description provided.

let mut stream = TcpStream::connect(server_addr).unwrap();
let server_addr = matches.value_of("host").unwrap().to_string();
let server_port = matches.value_of("port").unwrap_or("1883").to_string();
let server_host = [server_addr, ":".to_string(), server_port].concat();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    let server_addr = matches.value_of("host").unwrap();
    let server_port = matches.value_of("port").unwrap_or("1883");
    let server_host = format!("{}:{}", server_addr, server_port);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-line suggestions don't work :(

@mvlabat
Copy link
Owner

mvlabat commented Jul 30, 2019

1 more advise: install and run rustfmt :)

rustup component add rustfmt
cargo fmt

And even better with clippy!

rustup component add clippy
cargo clippy

@vladdancer
Copy link
Contributor Author

Updated.

@mvlabat mvlabat merged commit 65abed7 into mvlabat:master Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants