Skip to content

Commit 3aa18b1

Browse files
committed
formatting and updating rust
1 parent d99b1ca commit 3aa18b1

File tree

9 files changed

+30
-18
lines changed

9 files changed

+30
-18
lines changed

Diff for: rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.77.2"
2+
channel = "1.83.0"
33
components = ["clippy", "rustfmt"]
44
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu"]

Diff for: src/packs/caching/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ pub enum CacheResult {
1212

1313
#[derive(Debug, Default)]
1414
pub struct EmptyCacheEntry {
15+
#[allow(dead_code)]
1516
pub filepath: PathBuf,
1617
pub file_contents_digest: String,
18+
#[allow(dead_code)]
1719
pub file_name_digest: String,
1820
pub cache_file_path: PathBuf,
1921
}

Diff for: src/packs/configuration.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ mod tests {
380380

381381
assert!(!actual.cache_enabled);
382382

383-
let expected_readme_template_path = absolute_root.join("README_TEMPLATE.md");
383+
let expected_readme_template_path =
384+
absolute_root.join("README_TEMPLATE.md");
384385
assert_eq!(actual.readme_template_path, expected_readme_template_path);
385386
}
386387

@@ -470,11 +471,13 @@ mod tests {
470471

471472
#[test]
472473
fn with_readme_template_path() {
473-
let absolute_root = PathBuf::from("tests/fixtures/app_with_custom_readme");
474+
let absolute_root =
475+
PathBuf::from("tests/fixtures/app_with_custom_readme");
474476
let actual = configuration::get(&absolute_root).unwrap();
475477

476478
let actual_readme_template_path = actual.readme_template_path;
477-
let expected_readme_template_path = absolute_root.join("config/packs/README_EXAMPLE.md");
479+
let expected_readme_template_path =
480+
absolute_root.join("config/packs/README_EXAMPLE.md");
478481
assert_eq!(actual_readme_template_path, expected_readme_template_path);
479482
}
480483
}

Diff for: src/packs/creator.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn create(
6262
fn readme(configuration: &Configuration, pack_name: &str) -> String {
6363
let readme_template_path = configuration.readme_template_path.clone();
6464

65-
let readme_template = if readme_template_path.exists() {
65+
if readme_template_path.exists() {
6666
std::fs::read_to_string(readme_template_path).unwrap()
6767
} else {
6868
format!(
@@ -83,9 +83,7 @@ README.md should change as your public API changes.
8383
See https://github.com/rubyatscale/pks#readme for more info!",
8484
pack_name
8585
)
86-
};
87-
88-
readme_template
86+
}
8987
}
9088

9189
fn is_rails(configuration: &Configuration) -> bool {

Diff for: src/packs/pack_set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ impl PackSet {
108108
pub fn all_pack_dependencies<'a>(
109109
&'a self,
110110
configuration: &'a Configuration,
111-
) -> Result<Vec<PackDependency>> {
112-
let mut pack_refs: Vec<PackDependency> = Vec::new();
111+
) -> Result<Vec<PackDependency<'a>>> {
112+
let mut pack_refs: Vec<PackDependency<'a>> = Vec::new();
113113
for from_pack in &configuration.pack_set.packs {
114114
for dependency_pack_name in &from_pack.dependencies {
115115
match configuration.pack_set.for_pack(dependency_pack_name) {

Diff for: src/packs/parsing/ruby/experimental/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct ReferenceCollector<'a> {
2525
pub custom_associations: Vec<String>,
2626
}
2727

28-
impl<'a> Visitor for ReferenceCollector<'a> {
28+
impl Visitor for ReferenceCollector<'_> {
2929
fn on_class(&mut self, node: &nodes::Class) {
3030
// We're not collecting definitions, so no need to visit the class definitioname);
3131
let namespace_result = fetch_const_name(&node.name);

Diff for: src/packs/parsing/ruby/packwerk/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct ReferenceCollector<'a> {
3636
pub custom_associations: Vec<String>,
3737
}
3838

39-
impl<'a> Visitor for ReferenceCollector<'a> {
39+
impl Visitor for ReferenceCollector<'_> {
4040
fn on_class(&mut self, node: &nodes::Class) {
4141
// We're not collecting definitions, so no need to visit the class definitioname);
4242
let namespace_result = fetch_const_name(&node.name);

Diff for: tests/common/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ pub fn delete_foobar() {
3333

3434
#[allow(dead_code)]
3535
pub fn delete_foobaz() {
36-
let directory = PathBuf::from("tests/fixtures/simple_packs_first_app/packs/foobaz");
36+
let directory =
37+
PathBuf::from("tests/fixtures/simple_packs_first_app/packs/foobaz");
3738
if let Err(err) = fs::remove_dir_all(directory) {
3839
eprintln!(
3940
"Failed to remove tests/fixtures/simple_packs_first_app/packs/foobaz during test teardown: {}",
@@ -44,7 +45,8 @@ pub fn delete_foobaz() {
4445

4546
#[allow(dead_code)]
4647
pub fn delete_foobar_app_with_custom_readme() {
47-
let directory = PathBuf::from("tests/fixtures/app_with_custom_readme/packs/foobar");
48+
let directory =
49+
PathBuf::from("tests/fixtures/app_with_custom_readme/packs/foobar");
4850
if let Err(err) = fs::remove_dir_all(directory) {
4951
eprintln!(
5052
"Failed to remove tests/fixtures/app_with_custom_readme/packs/foobar during test teardown: {}",

Diff for: tests/create_test.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ See https://github.com/rubyatscale/pks#readme for more info!");
6767
}
6868

6969
#[test]
70-
fn test_create_with_readme_template_default_path() -> Result<(), Box<dyn Error>> {
70+
fn test_create_with_readme_template_default_path() -> Result<(), Box<dyn Error>>
71+
{
7172
common::delete_foobaz();
7273

73-
fs::write("tests/fixtures/simple_packs_first_app/README_TEMPLATE.md", "This is a test custom README template")?;
74+
fs::write(
75+
"tests/fixtures/simple_packs_first_app/README_TEMPLATE.md",
76+
"This is a test custom README template",
77+
)?;
7478

7579
Command::cargo_bin("pks")?
7680
.arg("--project-root")
@@ -90,13 +94,16 @@ fn test_create_with_readme_template_default_path() -> Result<(), Box<dyn Error>>
9094

9195
common::teardown();
9296
common::delete_foobaz();
93-
fs::remove_file("tests/fixtures/simple_packs_first_app/README_TEMPLATE.md")?;
97+
fs::remove_file(
98+
"tests/fixtures/simple_packs_first_app/README_TEMPLATE.md",
99+
)?;
94100

95101
Ok(())
96102
}
97103

98104
#[test]
99-
fn test_create_with_readme_template_custom_path() -> Result<(), Box<dyn Error>> {
105+
fn test_create_with_readme_template_custom_path() -> Result<(), Box<dyn Error>>
106+
{
100107
common::delete_foobar_app_with_custom_readme();
101108

102109
Command::cargo_bin("pks")?

0 commit comments

Comments
 (0)