summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/msrv.yml2
-rw-r--r--examples/glob/main.rs24
-rw-r--r--examples/global/main.rs1
-rw-r--r--examples/hierarchical-env/settings.rs47
-rw-r--r--examples/simple/main.rs10
-rw-r--r--examples/watch/main.rs1
-rw-r--r--src/builder.rs4
-rw-r--r--src/file/source/file.rs2
-rw-r--r--src/lib.rs1
-rw-r--r--src/ser.rs20
-rw-r--r--tests/async_builder.rs4
-rw-r--r--tests/env.rs6
-rw-r--r--tests/errors.rs2
-rw-r--r--tests/file_json.rs2
-rw-r--r--tests/file_json5.rs2
-rw-r--r--tests/file_ron.rs2
-rw-r--r--tests/file_toml.rs2
-rw-r--r--tests/file_yaml.rs2
-rw-r--r--tests/get.rs4
-rw-r--r--tests/legacy/errors.rs2
-rw-r--r--tests/legacy/file_json.rs2
-rw-r--r--tests/legacy/file_ron.rs2
-rw-r--r--tests/legacy/file_toml.rs2
-rw-r--r--tests/legacy/file_yaml.rs2
-rw-r--r--tests/legacy/get.rs4
25 files changed, 82 insertions, 70 deletions
diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml
index 00ea3cd..25fc2f2 100644
--- a/.github/workflows/msrv.yml
+++ b/.github/workflows/msrv.yml
@@ -136,7 +136,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
- args: -- -D warnings
+ args: --all-targets --all-features -- -D warnings
check-examples:
name: Check examples
diff --git a/examples/glob/main.rs b/examples/glob/main.rs
index ce2de45..d5225a0 100644
--- a/examples/glob/main.rs
+++ b/examples/glob/main.rs
@@ -7,14 +7,12 @@ fn main() {
// Option 1
// --------
// Gather all conf files from conf/ manually
- let mut settings = Config::default();
- settings
+ let settings = Config::builder()
// File::with_name(..) is shorthand for File::from(Path::new(..))
- .merge(File::with_name("examples/glob/conf/00-default.toml"))
- .unwrap()
- .merge(File::from(Path::new("examples/glob/conf/05-some.yml")))
- .unwrap()
- .merge(File::from(Path::new("examples/glob/conf/99-extra.json")))
+ .add_source(File::with_name("examples/glob/conf/00-default.toml"))
+ .add_source(File::from(Path::new("examples/glob/conf/05-some.yml")))
+ .add_source(File::from(Path::new("examples/glob/conf/99-extra.json")))
+ .build()
.unwrap();
// Print out our settings (as a HashMap)
@@ -28,13 +26,13 @@ fn main() {
// Option 2
// --------
// Gather all conf files from conf/ manually, but put in 1 merge call.
- let mut settings = Config::default();
- settings
- .merge(vec![
+ let settings = Config::builder()
+ .add_source(vec![
File::with_name("examples/glob/conf/00-default.toml"),
File::from(Path::new("examples/glob/conf/05-some.yml")),
File::from(Path::new("examples/glob/conf/99-extra.json")),
])
+ .build()
.unwrap();
// Print out our settings (as a HashMap)
@@ -48,14 +46,14 @@ fn main() {
// Option 3
// --------
// Gather all conf files from conf/ using glob and put in 1 merge call.
- let mut settings = Config::default();
- settings
- .merge(
+ let settings = Config::builder()
+ .add_source(
glob("examples/glob/conf/*")
.unwrap()
.map(|path| File::from(path.unwrap()))
.collect::<Vec<_>>(),
)
+ .build()
.unwrap();
// Print out our settings (as a HashMap)
diff --git a/examples/global/main.rs b/examples/global/main.rs
index 3a70253..b0dc6be 100644
--- a/examples/global/main.rs
+++ b/examples/global/main.rs
@@ -1,3 +1,4 @@
+#![allow(deprecated)]
use config::Config;
use lazy_static::lazy_static;
use std::error::Error;
diff --git a/examples/hierarchical-env/settings.rs b/examples/hierarchical-env/settings.rs
index 6286e5c..65b5f87 100644
--- a/examples/hierarchical-env/settings.rs
+++ b/examples/hierarchical-env/settings.rs
@@ -3,11 +3,13 @@ use serde_derive::Deserialize;
use std::env;
#[derive(Debug, Deserialize)]
+#[allow(unused)]
struct Database {
url: String,
}
#[derive(Debug, Deserialize)]
+#[allow(unused)]
struct Sparkpost {
key: String,
token: String,
@@ -16,12 +18,14 @@ struct Sparkpost {
}
#[derive(Debug, Deserialize)]
+#[allow(unused)]
struct Twitter {
consumer_token: String,
consumer_secret: String,
}
#[derive(Debug, Deserialize)]
+#[allow(unused)]
struct Braintree {
merchant_id: String,
public_key: String,
@@ -29,6 +33,7 @@ struct Braintree {
}
#[derive(Debug, Deserialize)]
+#[allow(unused)]
pub struct Settings {
debug: bool,
database: Database,
@@ -39,29 +44,27 @@ pub struct Settings {
impl Settings {
pub fn new() -> Result<Self, ConfigError> {
- let mut s = Config::default();
+ let run_mode = env::var("RUN_MODE").unwrap_or_else(|_| "development".into());
- // Start off by merging in the "default" configuration file
- s.merge(File::with_name("examples/hierarchical-env/config/default"))?;
-
- // Add in the current environment file
- // Default to 'development' env
- // Note that this file is _optional_
- let env = env::var("RUN_MODE").unwrap_or_else(|_| "development".into());
- s.merge(
- File::with_name(&format!("examples/hierarchical-env/config/{}", env)).required(false),
- )?;
-
- // Add in a local configuration file
- // This file shouldn't be checked in to git
- s.merge(File::with_name("examples/hierarchical-env/config/local").required(false))?;
-
- // Add in settings from the environment (with a prefix of APP)
- // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
- s.merge(Environment::with_prefix("app"))?;
-
- // You may also programmatically change settings
- s.set("database.url", "postgres://")?;
+ let s = Config::builder()
+ // Start off by merging in the "default" configuration file
+ .add_source(File::with_name("examples/hierarchical-env/config/default"))
+ // Add in the current environment file
+ // Default to 'development' env
+ // Note that this file is _optional_
+ .add_source(
+ File::with_name(&format!("examples/hierarchical-env/config/{}", run_mode))
+ .required(false),
+ )
+ // Add in a local configuration file
+ // This file shouldn't be checked in to git
+ .add_source(File::with_name("examples/hierarchical-env/config/local").required(false))
+ // Add in settings from the environment (with a prefix of APP)
+ // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
+ .add_source(Environment::with_prefix("app"))
+ // You may also programmatically change settings
+ .set_override("database.url", "postgres://")?
+ .build()?;
// Now that we're done, let's access our configuration
println!("debug: {:?}", s.get_bool("debug"));
diff --git a/examples/simple/main.rs b/examples/simple/main.rs
index 5aa8818..55ae8ac 100644
--- a/examples/simple/main.rs
+++ b/examples/simple/main.rs
@@ -1,14 +1,14 @@
+use config::Config;
use std::collections::HashMap;
fn main() {
- let mut settings = config::Config::default();
- settings
+ let settings = Config::builder()
// Add in `./Settings.toml`
- .merge(config::File::with_name("examples/simple/Settings"))
- .unwrap()
+ .add_source(config::File::with_name("examples/simple/Settings"))
// Add in settings from the environment (with a prefix of APP)
// Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
- .merge(config::Environment::with_prefix("APP"))
+ .add_source(config::Environment::with_prefix("APP"))
+ .build()
.unwrap();
// Print out our settings (as a HashMap)
diff --git a/examples/watch/main.rs b/examples/watch/main.rs
index 25d4b59..801ee4f 100644
--- a/examples/watch/main.rs
+++ b/examples/watch/main.rs
@@ -1,3 +1,4 @@
+#![allow(deprecated)]
use config::{Config, File};
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use std::collections::HashMap;
diff --git a/src/builder.rs b/src/builder.rs
index f429ad4..4942b47 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -272,7 +272,7 @@ impl ConfigBuilder<AsyncState> {
///
/// Calling this method does not invoke any I/O. [`Source`] is only saved in internal register for later use.
#[must_use]
- pub fn add_source<T>(mut self, source: T) -> ConfigBuilder<AsyncState>
+ pub fn add_source<T>(mut self, source: T) -> Self
where
T: Source + Send + Sync + 'static,
{
@@ -284,7 +284,7 @@ impl ConfigBuilder<AsyncState> {
///
/// Calling this method does not invoke any I/O. [`AsyncSource`] is only saved in internal register for later use.
#[must_use]
- pub fn add_async_source<T>(mut self, source: T) -> ConfigBuilder<AsyncState>
+ pub fn add_async_source<T>(mut self, source: T) -> Self
where
T: AsyncSource + Send + Sync + 'static,
{
diff --git a/src/file/source/file.rs b/src/file/source/file.rs
index 9bd3ddd..a27c9d2 100644
--- a/src/file/source/file.rs
+++ b/src/file/source/file.rs
@@ -73,7 +73,7 @@ impl FileSourceFile {
}
None => {
- for (format, extensions) in ALL_EXTENSIONS.iter() {
+ for format in ALL_EXTENSIONS.keys() {
for ext in format.extensions() {
filename.set_extension(ext);
diff --git a/src/lib.rs b/src/lib.rs
index 9088c26..589d2d5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,7 +17,6 @@
//!
//! See the [examples](https://github.com/mehcode/config-rs/tree/master/examples) for
//! general usage information.
-#![allow(unused_variables)]
#![allow(unknown_lints)]
// #![warn(missing_docs)]
diff --git a/src/ser.rs b/src/ser.rs
index 3138488..72d5b01 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -231,7 +231,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer {
fn serialize_tuple_variant(
self,
- name: &'static str,
+ _name: &'static str,
_variant_index: u32,
variant: &'static str,
_len: usize,
@@ -253,7 +253,7 @@ impl<'a> ser::Serializer for &'a mut ConfigSerializer {
_name: &'static str,
_variant_index: u32,
variant: &'static str,
- len: usize,
+ _len: usize,
) -> Result<Self::SerializeStructVariant> {
self.push_key(variant);
Ok(self)
@@ -580,7 +580,7 @@ impl ser::SerializeSeq for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_element<T>(&mut self, value: &T) -> Result<()>
+ fn serialize_element<T>(&mut self, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -596,7 +596,7 @@ impl ser::SerializeTuple for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_element<T>(&mut self, value: &T) -> Result<()>
+ fn serialize_element<T>(&mut self, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -612,7 +612,7 @@ impl ser::SerializeTupleStruct for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_field<T>(&mut self, value: &T) -> Result<()>
+ fn serialize_field<T>(&mut self, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -628,7 +628,7 @@ impl ser::SerializeTupleVariant for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_field<T>(&mut self, value: &T) -> Result<()>
+ fn serialize_field<T>(&mut self, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -644,14 +644,14 @@ impl ser::SerializeMap for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_key<T>(&mut self, key: &T) -> Result<()>
+ fn serialize_key<T>(&mut self, _key: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
unreachable!()
}
- fn serialize_value<T>(&mut self, value: &T) -> Result<()>
+ fn serialize_value<T>(&mut self, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -667,7 +667,7 @@ impl ser::SerializeStruct for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
+ fn serialize_field<T>(&mut self, _key: &'static str, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
@@ -683,7 +683,7 @@ impl ser::SerializeStructVariant for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
- fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
+ fn serialize_field<T>(&mut self, _key: &'static str, _value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
diff --git a/tests/async_builder.rs b/tests/async_builder.rs
index 6fea92c..51be9ca 100644
--- a/tests/async_builder.rs
+++ b/tests/async_builder.rs
@@ -46,7 +46,7 @@ async fn test_single_async_file_source() {
.await
.unwrap();
- assert_eq!(true, config.get::<bool>("debug").unwrap());
+ assert!(config.get::<bool>("debug").unwrap());
}
#[tokio::test]
@@ -65,7 +65,7 @@ async fn test_two_async_file_sources() {
.unwrap();
assert_eq!("Torre di Pisa", config.get::<String>("place.name").unwrap());
- assert_eq!(true, config.get::<bool>("debug_json").unwrap());
+ assert!(config.get::<bool>("debug_json").unwrap());
assert_eq!(1, config.get::<i32>("place.number").unwrap());
}
diff --git a/tests/env.rs b/tests/env.rs
index 4dafc46..97503a1 100644
--- a/tests/env.rs
+++ b/tests/env.rs
@@ -199,6 +199,7 @@ fn test_parse_off_int() {
#[derive(Deserialize, Debug)]
struct TestInt {
+ #[allow(dead_code)]
int_val_1: i32,
}
@@ -230,6 +231,7 @@ fn test_parse_off_float() {
#[derive(Deserialize, Debug)]
struct TestFloat {
+ #[allow(dead_code)]
float_val_1: f64,
}
@@ -261,6 +263,7 @@ fn test_parse_off_bool() {
#[derive(Deserialize, Debug)]
struct TestBool {
+ #[allow(dead_code)]
bool_val_1: bool,
}
@@ -292,6 +295,7 @@ fn test_parse_int_fail() {
#[derive(Deserialize, Debug)]
struct TestInt {
+ #[allow(dead_code)]
int_val_2: i32,
}
@@ -323,6 +327,7 @@ fn test_parse_float_fail() {
#[derive(Deserialize, Debug)]
struct TestFloat {
+ #[allow(dead_code)]
float_val_2: f64,
}
@@ -354,6 +359,7 @@ fn test_parse_bool_fail() {
#[derive(Deserialize, Debug)]
struct TestBool {
+ #[allow(dead_code)]
bool_val_2: bool,
}
diff --git a/tests/errors.rs b/tests/errors.rs
index 2b1ebd8..773fa46 100644
--- a/tests/errors.rs
+++ b/tests/errors.rs
@@ -106,11 +106,13 @@ fn test_error_enum_de() {
fn error_with_path() {
#[derive(Debug, Deserialize)]
struct Inner {
+ #[allow(dead_code)]
test: i32,
}
#[derive(Debug, Deserialize)]
struct Outer {
+ #[allow(dead_code)]
inner: Inner,
}
const CFG: &str = r#"
diff --git a/tests/file_json.rs b/tests/file_json.rs
index f7cda02..5969618 100644
--- a/tests/file_json.rs
+++ b/tests/file_json.rs
@@ -47,7 +47,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/file_json5.rs b/tests/file_json5.rs
index 4972fa2..d885ba4 100644
--- a/tests/file_json5.rs
+++ b/tests/file_json5.rs
@@ -46,7 +46,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/file_ron.rs b/tests/file_ron.rs
index e642f11..40d6159 100644
--- a/tests/file_ron.rs
+++ b/tests/file_ron.rs
@@ -49,7 +49,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/file_toml.rs b/tests/file_toml.rs
index 66e3453..c6f0c22 100644
--- a/tests/file_toml.rs
+++ b/tests/file_toml.rs
@@ -58,7 +58,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs
index 791b70a..927c108 100644
--- a/tests/file_yaml.rs
+++ b/tests/file_yaml.rs
@@ -47,7 +47,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/get.rs b/tests/get.rs
index 283d18a..806b82c 100644
--- a/tests/get.rs
+++ b/tests/get.rs
@@ -162,7 +162,7 @@ fn test_file_struct() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
@@ -179,7 +179,7 @@ fn test_scalar_struct() {
assert_eq!(p.name, "Torre di Pisa");
assert!(p.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(p.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(p.favorite, false);
+ assert!(!p.favorite);
assert_eq!(p.reviews, 3866);
assert_eq!(p.rating, Some(4.5));
assert_eq!(p.telephone, None);
diff --git a/tests/legacy/errors.rs b/tests/legacy/errors.rs
index e2b24bb..885580f 100644
--- a/tests/legacy/errors.rs
+++ b/tests/legacy/errors.rs
@@ -106,11 +106,13 @@ fn test_error_enum_de() {
fn error_with_path() {
#[derive(Debug, Deserialize)]
struct Inner {
+ #[allow(dead_code)]
test: i32,
}
#[derive(Debug, Deserialize)]
struct Outer {
+ #[allow(dead_code)]
inner: Inner,
}
const CFG: &str = r#"
diff --git a/tests/legacy/file_json.rs b/tests/legacy/file_json.rs
index 7945f0a..05a69de 100644
--- a/tests/legacy/file_json.rs
+++ b/tests/legacy/file_json.rs
@@ -48,7 +48,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/legacy/file_ron.rs b/tests/legacy/file_ron.rs
index 71accc6..b5286ab 100644
--- a/tests/legacy/file_ron.rs
+++ b/tests/legacy/file_ron.rs
@@ -49,7 +49,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/legacy/file_toml.rs b/tests/legacy/file_toml.rs
index 598d47e..5330d13 100644
--- a/tests/legacy/file_toml.rs
+++ b/tests/legacy/file_toml.rs
@@ -58,7 +58,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/legacy/file_yaml.rs b/tests/legacy/file_yaml.rs
index 5e55f90..091c1d3 100644
--- a/tests/legacy/file_yaml.rs
+++ b/tests/legacy/file_yaml.rs
@@ -48,7 +48,7 @@ fn test_file() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
diff --git a/tests/legacy/get.rs b/tests/legacy/get.rs
index 5e41307..e87f01f 100644
--- a/tests/legacy/get.rs
+++ b/tests/legacy/get.rs
@@ -162,7 +162,7 @@ fn test_file_struct() {
assert_eq!(s.place.name, "Torre di Pisa");
assert!(s.place.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(s.place.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(s.place.favorite, false);
+ assert!(!s.place.favorite);
assert_eq!(s.place.reviews, 3866);
assert_eq!(s.place.rating, Some(4.5));
assert_eq!(s.place.telephone, None);
@@ -179,7 +179,7 @@ fn test_scalar_struct() {
assert_eq!(p.name, "Torre di Pisa");
assert!(p.longitude.approx_eq_ulps(&43.7224985, 2));
assert!(p.latitude.approx_eq_ulps(&10.3970522, 2));
- assert_eq!(p.favorite, false);
+ assert!(!p.favorite);
assert_eq!(p.reviews, 3866);
assert_eq!(p.rating, Some(4.5));
assert_eq!(p.telephone, None);