From 540de0bfdfc5704da114756b0d0b02fdc68a261e Mon Sep 17 00:00:00 2001 From: Alexander Hansen Date: Mon, 23 Dec 2024 14:32:19 -0800 Subject: [PATCH] fmt --- compiler/qsc/src/lib.rs | 10 ++-------- compiler/qsc_hir/src/hir.rs | 2 +- vscode/src/debugger/output.ts | 2 +- vscode/src/testExplorer.ts | 10 +++------- wasm/src/test_discovery.rs | 36 +++++++++++++++++++---------------- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/compiler/qsc/src/lib.rs b/compiler/qsc/src/lib.rs index 742e25c540..4d0e97dd85 100644 --- a/compiler/qsc/src/lib.rs +++ b/compiler/qsc/src/lib.rs @@ -20,9 +20,7 @@ pub mod test_callables { pub location: Location, } - pub fn get_test_callables( - unit: &CompileUnit - ) -> impl Iterator + '_ { + pub fn get_test_callables(unit: &CompileUnit) -> impl Iterator + '_ { let test_callables = unit.package.get_test_callables(); test_callables.into_iter().map(|(name, span)| { @@ -33,11 +31,7 @@ pub mod test_callables { let location = Location { source: source.name.clone(), - range: Range::from_span( - Encoding::Utf8, - &source.contents, - &(span - source.offset), - ), + range: Range::from_span(Encoding::Utf8, &source.contents, &(span - source.offset)), }; TestDescriptor { callable_name: name, diff --git a/compiler/qsc_hir/src/hir.rs b/compiler/qsc_hir/src/hir.rs index 20bf445a3e..bcefb8ed9c 100644 --- a/compiler/qsc_hir/src/hir.rs +++ b/compiler/qsc_hir/src/hir.rs @@ -319,7 +319,7 @@ impl Package { let span = item.span; - Some((name,span)) + Some((name, span)) } else { None } diff --git a/vscode/src/debugger/output.ts b/vscode/src/debugger/output.ts index bcc1c7d0db..de888fce1e 100644 --- a/vscode/src/debugger/output.ts +++ b/vscode/src/debugger/output.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { log, QscEventTarget } from "qsharp-lang"; +import { QscEventTarget } from "qsharp-lang"; function formatComplex(real: number, imag: number) { // Format -0 as 0 diff --git a/vscode/src/testExplorer.ts b/vscode/src/testExplorer.ts index bff3ae7280..b4b6887950 100644 --- a/vscode/src/testExplorer.ts +++ b/vscode/src/testExplorer.ts @@ -4,11 +4,7 @@ // This file uses the VS Code Test Explorer API (https://code.visualstudio.com/docs/editor/testing) import * as vscode from "vscode"; -import { - ICompilerWorker, - log, - ProgramConfig, -} from "qsharp-lang"; +import { ICompilerWorker, log, ProgramConfig } from "qsharp-lang"; import { getActiveProgram } from "./programConfig"; import { getCommonCompilerWorker, @@ -69,7 +65,7 @@ function mkRefreshHandler( const part = parts[i]; const id = i === parts.length - 1 ? callableName : part; if (!rover.get(part)) { - let testItem = ctrl.createTestItem(id, part, vscLocation.uri); + const testItem = ctrl.createTestItem(id, part, vscLocation.uri); testItem.range = vscLocation.range; rover.add(testItem); } @@ -178,7 +174,7 @@ async function runTestCase( } const run = ctrl.createTestRun(request); const evtTarget = createDebugConsoleEventTarget((msg) => { - run.appendOutput(msg); + run.appendOutput(`${msg}\n`); }); evtTarget.addEventListener("Result", (msg) => { if (msg.detail.success) { diff --git a/wasm/src/test_discovery.rs b/wasm/src/test_discovery.rs index f3855e32eb..1600e672f8 100644 --- a/wasm/src/test_discovery.rs +++ b/wasm/src/test_discovery.rs @@ -2,12 +2,12 @@ // Licensed under the MIT License. use qsc::{compile, PackageType}; +use serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::wasm_bindgen; -use serde::{Serialize, Deserialize}; - use crate::{ - project_system::{into_qsc_args, ProgramConfig}, serializable_type, STORE_CORE_STD + project_system::{into_qsc_args, ProgramConfig}, + serializable_type, STORE_CORE_STD, }; serializable_type! { @@ -37,20 +37,24 @@ pub fn get_test_callables(config: ProgramConfig) -> Result, PackageType::Lib, capabilities, language_features, - ); + ); unit }); - - let test_descriptors = qsc::test_callables::get_test_callables( - &compile_unit - ); - - Ok(test_descriptors.map(|qsc::test_callables::TestDescriptor { callable_name, location }| { - TestDescriptor { - callable_name, - location: location.into(), - }.into() - }).collect()) - + let test_descriptors = qsc::test_callables::get_test_callables(&compile_unit); + + Ok(test_descriptors + .map( + |qsc::test_callables::TestDescriptor { + callable_name, + location, + }| { + TestDescriptor { + callable_name, + location: location.into(), + } + .into() + }, + ) + .collect()) }