Skip to content

Commit 3def61c

Browse files
authored
fix: CI and various other updates (rust-lang#83)
- cargo clippy fixes - bump MSRV - License syntax - author email address
2 parents a6464da + d057506 commit 3def61c

File tree

24 files changed

+60
-65
lines changed

24 files changed

+60
-65
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
windows-latest
2626
]
2727
version:
28-
- 1.47.0
28+
- 1.63.0
2929
- stable
3030
- nightly
3131

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
[![Crate](https://img.shields.io/crates/v/varlink.svg)](https://crates.io/crates/varlink)
88
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/varlink/)
99
[![dependency status](https://deps.rs/repo/github/varlink/rust/status.svg)](https://deps.rs/repo/github/varlink/rust)
10-
![Rust Version 1.47+](https://img.shields.io/badge/rustc-v1.47%2B-blue.svg)
10+
![Rust Version 1.63+](https://img.shields.io/badge/rustc-v1.63%2B-blue.svg)
1111

1212

1313
See http://varlink.org for more information about varlink.
1414

1515
## Example usage
1616
Look into the examples directory. ```build.rs``` contains the magic, which will build rust bindings for the varlink interface definition file.
17-
17+
Or use `varlink_derive` to generate the bindings at compile time.
1818
## More Info
1919

2020
* [Git Repo](https://github.com/varlink/rust)

examples/example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "example"
33
version = "3.0.2"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66
publish = false
77

examples/example/src/test.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ fn run_self_test(address: &'static str) -> Result<()> {
1919
if let Err(e) = ret {
2020
panic!("error: {}", e);
2121
}
22-
if let Err(_) = child.join() {
23-
Err(format!("Error joining thread").into())
24-
} else {
25-
Ok(())
26-
}
22+
child
23+
.join()
24+
.map_err(|_| "Error joining thread".to_string())?;
25+
Ok(())
2726
}
2827

2928
#[test]

examples/more/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "more"
33
version = "2.0.2"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
build = "build.rs"
66
edition = "2018"
77
publish = false

examples/more/src/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ fn run_self_test(address: String) -> Result<()> {
2222
if let Err(e) = ret {
2323
panic!("error: {}", e);
2424
}
25-
if let Err(_) = child.join() {
26-
Err("Error joining thread".into())
27-
} else {
28-
Ok(())
29-
}
25+
26+
child
27+
.join()
28+
.map_err(|_| "Error joining thread".to_string())?;
29+
Ok(())
3030
}
3131

3232
#[test]

examples/ping/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ping"
33
version = "2.0.2"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
build = "build.rs"
66
edition = "2018"
77
publish = false

examples/ping/src/test.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn run_self_test(address: String, multiplex: bool) -> Result<()> {
4242
let b = &br[10..20];
4343
let c = &br[20..];
4444

45-
for i in vec![a, b, c] {
45+
for i in &[a, b, c] {
4646
assert!(writer.write_all(i).is_ok());
4747
assert!(writer.flush().is_ok());
4848
thread::sleep(time::Duration::from_millis(500));
@@ -86,7 +86,7 @@ fn run_self_test(address: String, multiplex: bool) -> Result<()> {
8686
let b = &br[10..20];
8787
let c = &br[20..];
8888

89-
for i in vec![a, b, c] {
89+
for i in &[a, b, c] {
9090
assert!(writer.write_all(i).is_ok());
9191
assert!(writer.flush().is_ok());
9292
thread::sleep(time::Duration::from_millis(500));
@@ -115,7 +115,7 @@ fn run_self_test(address: String, multiplex: bool) -> Result<()> {
115115
let b = &br[10..20];
116116
let c = &br[20..];
117117

118-
for i in vec![a, b, c] {
118+
for i in &[a, b, c] {
119119
assert!(writer.write_all(i).is_ok());
120120
assert!(writer.flush().is_ok());
121121
thread::sleep(time::Duration::from_millis(500));
@@ -146,11 +146,10 @@ fn run_self_test(address: String, multiplex: bool) -> Result<()> {
146146
}
147147
eprintln!("run_client finished");
148148

149-
if let Err(_) = child.join() {
150-
Err(format!("Error joining thread").into())
151-
} else {
152-
Ok(())
153-
}
149+
child
150+
.join()
151+
.map_err(|_| "Error joining thread".to_string())?;
152+
Ok(())
154153
}
155154

156155
#[cfg(target_os = "not_working")]

varlink-certification/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "varlink-certification"
33
version = "2.0.4"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
build = "build.rs"
66
edition = "2018"
77
publish = false

varlink-certification/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,12 @@ impl org_varlink_certification::VarlinkInterface for CertInterface {
374374
| Some(&varlink::Request {
375375
oneway: Some(true), ..
376376
}) => false,
377-
Some(&varlink::Request {
378-
method: ref m,
379-
parameters: ref p,
377+
Some(varlink::Request {
378+
method: m,
379+
parameters: p,
380380
..
381381
}) if m == "org.varlink.certification.Start"
382-
&& (*p == None
382+
&& (p.is_none()
383383
|| *p == Some(serde_json::Value::Object(serde_json::Map::new()))) =>
384384
{
385385
true
@@ -717,7 +717,7 @@ impl ClientIds {
717717
let pop = match self.lifetimes.front() {
718718
None => false,
719719

720-
Some(&(ref instant, ref client_id)) => {
720+
Some((instant, client_id)) => {
721721
if instant.elapsed().as_secs() > self.max_lifetime {
722722
self.contexts.remove(client_id);
723723
true

varlink-certification/src/test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ fn run_self_test(address: String) -> Result<()> {
2323
if let Err(e) = ret {
2424
panic!("error: {:?}", e);
2525
}
26-
if let Err(_) = child.join() {
27-
Err(format!("Error joining thread").into())
28-
} else {
29-
Ok(())
30-
}
26+
27+
child
28+
.join()
29+
.map_err(|_| "Error joining thread".to_string())?;
30+
Ok(())
3131
}
3232

3333
#[test]
@@ -48,5 +48,5 @@ fn test_tcp() -> Result<()> {
4848

4949
#[test]
5050
fn test_wrong_address_1() {
51-
assert!(crate::run_server("tcpd:0.0.0.0:12345".into(), 1).is_err());
51+
assert!(crate::run_server("tcpd:0.0.0.0:12345", 1).is_err());
5252
}

varlink-cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "varlink-cli"
33
version = "4.5.3"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66

7-
license = "MIT/Apache-2.0"
7+
license = "MIT OR Apache-2.0"
88
documentation = "https://github.com/varlink/rust/blob/master/varlink/README.md"
99
homepage = "https://github.com/varlink/rust/blob/master/varlink-cli"
1010
repository = "https://github.com/varlink/rust"

varlink-cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn varlink_help(
144144
}
145145
};
146146

147-
if interface.find('.') == None {
147+
if interface.find('.').is_none() {
148148
return Err(format!("Invalid address {}", url).into());
149149
}
150150

@@ -213,14 +213,14 @@ fn varlink_call(
213213
if let Some(del) = url.rfind('/') {
214214
address = &url[0..del];
215215
method = &url[(del + 1)..];
216-
if method.find('.') == None {
216+
if method.find('.').is_none() {
217217
return Err(format!("Invalid address {}", url).into());
218218
}
219219
} else {
220220
if let Some(del) = url.rfind('.') {
221221
interface = &url[0..del];
222222
method = url;
223-
if method.find('.') == None {
223+
if method.find('.').is_none() {
224224
return Err(format!("Invalid address {}", url).into());
225225
}
226226
} else {

varlink/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "varlink"
33
version = "11.0.1"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66

7-
license = "MIT/Apache-2.0"
7+
license = "MIT OR Apache-2.0"
88
documentation = "https://github.com/varlink/rust/blob/master/varlink/README.md"
99
homepage = "https://github.com/varlink/rust/blob/master/varlink"
1010
repository = "https://github.com/varlink/rust"

varlink/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn varlink_connect<S: ?Sized + AsRef<str>>(address: &S) -> Result<(Box<dyn S
2525

2626
if let Some(addr) = new_address.strip_prefix("tcp:") {
2727
Ok((
28-
Box::new(TcpStream::connect(&addr).map_err(map_context!())?),
28+
Box::new(TcpStream::connect(addr).map_err(map_context!())?),
2929
new_address,
3030
))
3131
} else if let Some(addr) = new_address.strip_prefix("unix:") {

varlink/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ where
11311131
conn.writer = self.writer.take();
11321132
}
11331133
}
1134-
if reply.error != None {
1134+
if reply.error.is_some() {
11351135
return Err(context!(ErrorKind::from(reply)).into());
11361136
}
11371137

varlink/src/server.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,11 @@ fn activation_listener() -> Option<usize> {
5151
return Some(3);
5252
}
5353

54-
let fdnames = match env::var("LISTEN_FDNAMES") {
55-
Ok(n) => n,
56-
_ => return None,
57-
};
54+
let fdnames = env::var("LISTEN_FDNAMES").ok()?;
5855

5956
for (i, v) in fdnames.split(':').enumerate() {
6057
if v == "varlink" {
61-
return Some(3 + i as usize);
58+
return Some(3 + i);
6259
}
6360
}
6461

@@ -134,7 +131,7 @@ impl Listener {
134131

135132
if let Some(addr) = address.strip_prefix("tcp:") {
136133
Ok(Listener::TCP(
137-
Some(TcpListener::bind(&addr).map_err(map_context!())?),
134+
Some(TcpListener::bind(addr).map_err(map_context!())?),
138135
false,
139136
))
140137
} else if let Some(addr) = address.strip_prefix("unix:") {

varlink/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ fn test_handle() -> Result<()> {
172172
panic!("Unexpected handle return value {}", iface);
173173
}
174174
(v, None) => {
175-
if v.len() == 0 {
175+
if v.is_empty() {
176176
break;
177177
}
178178
//eprintln!("unhandled: {}", String::from_utf8_lossy(&v));

varlink_derive/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "varlink_derive"
33
version = "10.1.0"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
6-
license = "MIT/Apache-2.0"
6+
license = "MIT OR Apache-2.0"
77
documentation = "https://github.com/varlink/rust/blob/master/varlink/README.md"
88
homepage = "https://github.com/varlink/rust/blob/master/varlink_derive"
99
repository = "https://github.com/varlink/rust"

varlink_generator/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "varlink_generator"
33
version = "10.1.0"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66

7-
license = "MIT/Apache-2.0"
7+
license = "MIT OR Apache-2.0"
88
documentation = "https://github.com/varlink/rust/blob/master/varlink/README.md"
99
homepage = "https://github.com/varlink/rust/blob/master/varlink_generator"
1010
repository = "https://github.com/varlink/rust"

varlink_generator/tests/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fn test_generate() {
2727
1,
2828
))
2929
.unwrap();
30-
return false;
30+
false
3131
} else {
32-
return true;
32+
true
3333
}
3434
}
3535

varlink_parser/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "varlink_parser"
33
version = "4.2.0"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66

7-
license = "MIT/Apache-2.0"
7+
license = "MIT OR Apache-2.0"
88
documentation = "https://docs.rs/varlink_parser/"
99
homepage = "https://github.com/varlink/rust/blob/master/varlink_parser"
1010
repository = "https://github.com/varlink/rust"

varlink_parser/src/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ error InvalidParameter (parameter: string)
4545
"
4646
);
4747
assert_eq!(
48-
v.methods.get("GetInterfaceDescription".into()).unwrap().doc,
48+
v.methods.get("GetInterfaceDescription").unwrap().doc,
4949
"# Get the description of an interface that is implemented by this service."
5050
);
5151
//println!("{}", v.to_string());
@@ -109,7 +109,7 @@ error ErrorFoo (a: (b: bool, c: int), foo: TypeFoo)
109109
)
110110
.unwrap();
111111
assert_eq!(v.name, "org.example.complex");
112-
println!("{}", v.to_string());
112+
println!("{}", v);
113113
assert_eq!(
114114
v.to_string(),
115115
"\
@@ -160,7 +160,7 @@ error ErrorFoo1 (a: (foo: bool, bar: int, baz: (a: int, b: int), b: (beee: int))
160160
.unwrap();
161161
assert_eq!(v.name, "org.example.format");
162162
println!("{}", v.get_oneline());
163-
println!("{}", v.to_string());
163+
println!("{}", v);
164164
assert_eq!(
165165
v.to_string(),
166166
"\

varlink_stdinterfaces/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "varlink_stdinterfaces"
33
version = "11.0.2"
4-
authors = ["Harald Hoyer <harald@redhat.com>"]
4+
authors = ["Harald Hoyer <harald@hoyer.xyz>"]
55
edition = "2018"
66

7-
license = "MIT/Apache-2.0"
7+
license = "MIT OR Apache-2.0"
88
documentation = "https://github.com/varlink/rust/blob/master/varlink/README.md"
99
homepage = "https://github.com/varlink/rust/blob/master/varlink_stdinterfaces"
1010
repository = "https://github.com/varlink/rust"

0 commit comments

Comments
 (0)