Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/brioche-core/benches/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ fn bench_input_with_shared_ancestor_resources(bencher: divan::Bencher, removal:
let mut file =
std::fs::File::create(input_path.join(format!("file{i}.txt"))).unwrap();

writeln!(&mut file, "{i}",).unwrap();
writeln!(&mut file, "{i}").unwrap();

brioche_pack::inject_pack(
&mut file,
Expand Down
2 changes: 1 addition & 1 deletion crates/brioche-core/src/process_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn create_process_output_events(
elapsed: Duration,
stream: ProcessStream,
content: &[u8],
) -> impl Iterator<Item = ProcessOutputEvent> + '_ {
) -> impl Iterator<Item = ProcessOutputEvent> {
content
.chunks(ProcessOutputEvent::MAX_CONTENT_LENGTH)
.map(move |chunk| ProcessOutputEvent {
Expand Down
6 changes: 3 additions & 3 deletions crates/brioche-core/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ impl ProjectsInner {
Ok(workspace)
}

fn local_paths(&self, project_hash: ProjectHash) -> Option<impl Iterator<Item = &Path> + '_> {
fn local_paths(&self, project_hash: ProjectHash) -> Option<impl Iterator<Item = &Path>> {
let paths = self.projects_to_paths.get(&project_hash)?;
Some(paths.iter().map(|path| &**path))
}
Expand Down Expand Up @@ -551,7 +551,7 @@ impl ProjectsInner {
pub fn project_module_paths(
&self,
project_hash: ProjectHash,
) -> anyhow::Result<impl Iterator<Item = PathBuf> + '_> {
) -> anyhow::Result<impl Iterator<Item = PathBuf>> {
let project = self.project(project_hash)?;
let project_root = self
.projects_to_paths
Expand Down Expand Up @@ -587,7 +587,7 @@ impl ProjectsInner {
pub fn project_module_specifiers(
&self,
project_hash: ProjectHash,
) -> anyhow::Result<impl Iterator<Item = super::script::specifier::BriocheModuleSpecifier> + '_>
) -> anyhow::Result<impl Iterator<Item = super::script::specifier::BriocheModuleSpecifier>>
{
let module_paths = self.project_module_paths(project_hash)?;
let module_specifiers = module_paths
Expand Down
8 changes: 3 additions & 5 deletions crates/brioche-core/src/recipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,9 @@ impl Directory {
artifact: Option<Artifact>,
) -> Result<Option<Artifact>, DirectoryError> {
match path_components {
[] => {
return Err(DirectoryError::EmptyPath {
path: full_path.into(),
});
}
[] => Err(DirectoryError::EmptyPath {
path: full_path.into(),
}),
[filename] => {
let replaced_hash = match artifact {
Some(artifact) => {
Expand Down
6 changes: 3 additions & 3 deletions crates/brioche-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ mod tests {

#[test]
fn test_display_duration_basic() {
assert_eq!(display_duration_ms(0).to_string(), "0.00s",);
assert_eq!(display_duration_ms(10).to_string(), "0.01s",);
assert_eq!(display_duration_ms(99).to_string(), "0.10s",);
assert_eq!(display_duration_ms(0).to_string(), "0.00s");
assert_eq!(display_duration_ms(10).to_string(), "0.01s");
assert_eq!(display_duration_ms(99).to_string(), "0.10s");
assert_eq!(display_duration_ms(1_010).to_string(), "1.01s");
assert_eq!(display_duration_ms(59_990).to_string(), "59.99s");
assert_eq!(display_duration_ms(59_999).to_string(), "60.00s");
Expand Down
4 changes: 2 additions & 2 deletions crates/brioche-core/src/utils/output_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ mod tests {
output.append(job_stream(1, Stdout), "a\nb\nc");

assert_eq!(output.total_bytes, 5);
assert_eq!(output.contents, [(job_stream(1, Stdout), "a\nb\n".into())],);
assert_eq!(output.contents, [(job_stream(1, Stdout), "a\nb\n".into())]);
assert_eq!(
output.partial_append,
BTreeMap::from_iter([(job_stream(1, Stdout), "c".into())])
Expand Down Expand Up @@ -659,7 +659,7 @@ mod tests {
output.append(job_stream(1, Stdout), "a\nb\nc");

assert_eq!(output.total_bytes, 5);
assert_eq!(output.contents, [(job_stream(1, Stdout), "a\nb\n".into())],);
assert_eq!(output.contents, [(job_stream(1, Stdout), "a\nb\n".into())]);
assert_eq!(
output.partial_append,
BTreeMap::from_iter([(job_stream(1, Stdout), "c".into())]),
Expand Down
6 changes: 3 additions & 3 deletions crates/brioche-core/tests/bake_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn get(brioche: &brioche_core::Brioche, dir: &Directory, path: impl AsRef<
let path = bstr::BStr::new(path.as_ref());
try_get(brioche, dir, &path)
.await
.with_context(|| format!("error getting context for path {path:?}",))
.with_context(|| format!("error getting context for path {path:?}"))
.unwrap()
.with_context(|| format!("no artifact found for path {path:?}"))
.unwrap()
Expand Down Expand Up @@ -1421,7 +1421,7 @@ fn test_bake_process_output_with_shared_resources() -> anyhow::Result<()> {
false
)
),
("bar", brioche_test_support::symlink("bar_target"),),
("bar", brioche_test_support::symlink("bar_target")),
(
"bar_target",
brioche_test_support::file(
Expand Down Expand Up @@ -1465,7 +1465,7 @@ fn test_bake_process_output_with_shared_resources() -> anyhow::Result<()> {
false
)
),
("bar", brioche_test_support::symlink("bar_target"),),
("bar", brioche_test_support::symlink("bar_target")),
(
"bar_target",
brioche_test_support::file(
Expand Down
22 changes: 10 additions & 12 deletions crates/brioche/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub async fn check(
} else {
None
};
let project_name = project_name.as_ref().map(|name| name.as_str());
let project_name = project_name.map(String::as_str);

let result = run_check(
&reporter,
Expand Down Expand Up @@ -181,17 +181,15 @@ async fn run_check(

match result {
Ok(()) => {
if let Some(project_name) = project_name {
reporter.emit(superconsole::Lines::from_multiline_string(
&format!("No errors found in {project_name} 🎉",),
superconsole::style::ContentStyle::default(),
));
} else {
reporter.emit(superconsole::Lines::from_multiline_string(
"No errors found in projects 🎉",
superconsole::style::ContentStyle::default(),
));
}
let format_string = project_name.map_or_else(
|| "No errors found in projects 🎉".to_string(),
|project_name| format!("No errors found in {project_name} 🎉"),
);

reporter.emit(superconsole::Lines::from_multiline_string(
&format_string,
superconsole::style::ContentStyle::default(),
));

Ok(true)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/brioche/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async fn run_format(
Ok(true)
} else if files.is_empty() {
reporter.emit(superconsole::Lines::from_multiline_string(
&format!("All files of {project_name} are formatted",),
&format!("All files of {project_name} are formatted"),
superconsole::style::ContentStyle::default(),
));

Expand Down
2 changes: 1 addition & 1 deletion crates/brioche/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ async fn run_install(
};

reporter.emit(superconsole::Lines::from_multiline_string(
&format!("Build finished, completed {jobs_message} in {elapsed}",),
&format!("Build finished, completed {jobs_message} in {elapsed}"),
superconsole::style::ContentStyle::default(),
));

Expand Down
29 changes: 12 additions & 17 deletions crates/brioche/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,23 +339,18 @@ fn consolidate_result(
) {
match result {
Err(err) => {
if let Some(project_name) = project_name {
reporter.emit(superconsole::Lines::from_multiline_string(
&format!("Error occurred with {project_name}: {err}"),
superconsole::style::ContentStyle {
foreground_color: Some(superconsole::style::Color::Red),
..superconsole::style::ContentStyle::default()
},
));
} else {
reporter.emit(superconsole::Lines::from_multiline_string(
&format!("Error occurred in project: {err}"),
superconsole::style::ContentStyle {
foreground_color: Some(superconsole::style::Color::Red),
..superconsole::style::ContentStyle::default()
},
));
}
let format_string = project_name.map_or_else(
|| format!("Error occurred in project: {err}"),
|project_name| format!("Error occurred with {project_name}: {err}"),
);

reporter.emit(superconsole::Lines::from_multiline_string(
&format_string,
superconsole::style::ContentStyle {
foreground_color: Some(superconsole::style::Color::Red),
..superconsole::style::ContentStyle::default()
},
));

*error_result = Some(());
}
Expand Down
2 changes: 1 addition & 1 deletion crates/brioche/src/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async fn run_publish(
match result {
Ok(()) => {
reporter.emit(superconsole::Lines::from_multiline_string(
&format!("No errors found in {project_name} 🎉",),
&format!("No errors found in {project_name} 🎉"),
superconsole::style::ContentStyle::default(),
));
}
Expand Down