diff --git a/src/config/mod.rs b/src/config/mod.rs index 05de5000de8..bd12b05ca40 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -674,7 +674,7 @@ mod test { #[test] fn test_was_set() { - let config = Config::from_toml("hard_tabs = true", Path::new("")).unwrap(); + let config = Config::from_toml("hard_tabs = true", Path::new(".")).unwrap(); assert_eq!(config.was_set().hard_tabs(), true); assert_eq!(config.was_set().verbose(), false); @@ -933,7 +933,7 @@ make_backup = false #[nightly_only_test] #[test] fn test_unstable_from_toml() { - let config = Config::from_toml("unstable_features = true", Path::new("")).unwrap(); + let config = Config::from_toml("unstable_features = true", Path::new(".")).unwrap(); assert_eq!(config.was_set().unstable_features(), true); assert_eq!(config.unstable_features(), true); } @@ -963,7 +963,7 @@ make_backup = false unstable_features = true merge_imports = true "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.imports_granularity(), ImportGranularity::Crate); } @@ -975,7 +975,7 @@ make_backup = false merge_imports = true imports_granularity = "Preserve" "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.imports_granularity(), ImportGranularity::Preserve); } @@ -986,7 +986,7 @@ make_backup = false unstable_features = true merge_imports = true "#; - let mut config = Config::from_toml(toml, Path::new("")).unwrap(); + let mut config = Config::from_toml(toml, Path::new(".")).unwrap(); config.override_value("imports_granularity", "Preserve"); assert_eq!(config.imports_granularity(), ImportGranularity::Preserve); } @@ -998,7 +998,7 @@ make_backup = false unstable_features = true imports_granularity = "Module" "#; - let mut config = Config::from_toml(toml, Path::new("")).unwrap(); + let mut config = Config::from_toml(toml, Path::new(".")).unwrap(); config.override_value("merge_imports", "true"); // no effect: the new option always takes precedence assert_eq!(config.imports_granularity(), ImportGranularity::Module); @@ -1015,7 +1015,7 @@ make_backup = false use_small_heuristics = "Default" max_width = 200 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 120); assert_eq!(config.attr_fn_like_width(), 140); assert_eq!(config.chain_width(), 120); @@ -1031,7 +1031,7 @@ make_backup = false use_small_heuristics = "Max" max_width = 120 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 120); assert_eq!(config.attr_fn_like_width(), 120); assert_eq!(config.chain_width(), 120); @@ -1047,7 +1047,7 @@ make_backup = false use_small_heuristics = "Off" max_width = 100 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), usize::max_value()); assert_eq!(config.attr_fn_like_width(), usize::max_value()); assert_eq!(config.chain_width(), usize::max_value()); @@ -1069,7 +1069,7 @@ make_backup = false struct_lit_width = 30 struct_variant_width = 34 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 20); assert_eq!(config.attr_fn_like_width(), 40); assert_eq!(config.chain_width(), 20); @@ -1091,7 +1091,7 @@ make_backup = false struct_lit_width = 30 struct_variant_width = 34 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 20); assert_eq!(config.attr_fn_like_width(), 40); assert_eq!(config.chain_width(), 20); @@ -1113,7 +1113,7 @@ make_backup = false struct_lit_width = 30 struct_variant_width = 34 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 20); assert_eq!(config.attr_fn_like_width(), 40); assert_eq!(config.chain_width(), 20); @@ -1129,7 +1129,7 @@ make_backup = false max_width = 90 fn_call_width = 95 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.fn_call_width(), 90); } @@ -1139,7 +1139,7 @@ make_backup = false max_width = 80 attr_fn_like_width = 90 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.attr_fn_like_width(), 80); } @@ -1149,7 +1149,7 @@ make_backup = false max_width = 78 struct_lit_width = 90 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.struct_lit_width(), 78); } @@ -1159,7 +1159,7 @@ make_backup = false max_width = 80 struct_variant_width = 90 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.struct_variant_width(), 80); } @@ -1169,7 +1169,7 @@ make_backup = false max_width = 60 array_width = 80 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.array_width(), 60); } @@ -1179,7 +1179,7 @@ make_backup = false max_width = 80 chain_width = 90 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.chain_width(), 80); } @@ -1189,7 +1189,7 @@ make_backup = false max_width = 70 single_line_if_else_max_width = 90 "#; - let config = Config::from_toml(toml, Path::new("")).unwrap(); + let config = Config::from_toml(toml, Path::new(".")).unwrap(); assert_eq!(config.single_line_if_else_max_width(), 70); } diff --git a/src/ignore_path.rs b/src/ignore_path.rs index 5c25f233ce3..a756a172cb5 100644 --- a/src/ignore_path.rs +++ b/src/ignore_path.rs @@ -42,7 +42,7 @@ mod test { use std::path::{Path, PathBuf}; let config = - Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new("")).unwrap(); + Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new(".")).unwrap(); let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap(); assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs")))); @@ -59,7 +59,7 @@ mod test { let config = Config::from_toml( r#"ignore = ["foo.rs", "bar_dir/*", "!bar_dir/*/what.rs"]"#, - Path::new(""), + Path::new("."), ) .unwrap(); let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap(); diff --git a/src/parse/session.rs b/src/parse/session.rs index 4160e02b8f8..a4bd7fce513 100644 --- a/src/parse/session.rs +++ b/src/parse/session.rs @@ -395,7 +395,7 @@ mod tests { } fn get_ignore_list(config: &str) -> IgnoreList { - Config::from_toml(config, Path::new("")).unwrap().ignore() + Config::from_toml(config, Path::new(".")).unwrap().ignore() } #[test]