Skip to content

Commit

Permalink
Screenshot test: use BufWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Dec 27, 2023
1 parent 5aa6b42 commit 10df2dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/screenshots/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial

use std::io::Write;
use std::io::{BufWriter, Write};
use std::path::Path;

/// Returns a list of all the `.slint` files in the `tests/cases` subfolders.
Expand Down Expand Up @@ -45,9 +45,9 @@ fn main() -> std::io::Result<()> {
std::env::set_var("SLINT_DEFAULT_FONT", default_font_path.clone());
println!("cargo:rustc-env=SLINT_DEFAULT_FONT={}", default_font_path.display());

let mut generated_file = std::fs::File::create(
let mut generated_file = BufWriter::new(std::fs::File::create(
Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("generated.rs"),
)?;
)?);

let references_root_dir: std::path::PathBuf =
[env!("CARGO_MANIFEST_DIR"), "references"].iter().collect();
Expand Down Expand Up @@ -97,9 +97,9 @@ fn main() -> std::io::Result<()> {
})
});

let mut output = std::fs::File::create(
let mut output = BufWriter::new(std::fs::File::create(
Path::new(&std::env::var_os("OUT_DIR").unwrap()).join(format!("{}.rs", module_name)),
)?;
)?);

generate_source(source.as_str(), &mut output, testcase).unwrap();

Expand Down Expand Up @@ -136,7 +136,7 @@ fn main() -> std::io::Result<()> {

fn generate_source(
source: &str,
output: &mut std::fs::File,
output: &mut impl Write,
testcase: test_driver_lib::TestCase,
) -> Result<(), std::io::Error> {
use i_slint_compiler::{diagnostics::BuildDiagnostics, *};
Expand Down

0 comments on commit 10df2dc

Please sign in to comment.