Skip to content

Commit

Permalink
fix: solve code formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Oct 21, 2019
1 parent 870e7bd commit ed8552b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion crates/mun/src/main.rs
Expand Up @@ -4,8 +4,8 @@ extern crate failure;
use std::time::Duration;

use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
use mun_runtime::{invoke_fn, MunRuntime, RuntimeBuilder};
use mun_compiler::PathOrInline;
use mun_runtime::{invoke_fn, MunRuntime, RuntimeBuilder};

fn main() -> Result<(), failure::Error> {
let matches = App::new("mun")
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_codegen/src/ir/dispatch_table.rs
@@ -1,6 +1,6 @@
use crate::values::FunctionValue;
use crate::IrDatabase;
use inkwell::module::{Module};
use inkwell::module::Module;
use inkwell::types::BasicTypeEnum;
use inkwell::values::{BasicValueEnum, PointerValue};
use mun_hir as hir;
Expand Down Expand Up @@ -194,7 +194,7 @@ impl<'a, D: IrDatabase> DispatchTableBuilder<'a, D> {
DispatchTable {
function_to_idx: self.function_to_idx,
table_ref: self.table_ref,
entries: self.entries
entries: self.entries,
}
}
}
6 changes: 3 additions & 3 deletions crates/mun_codegen/src/ir/module.rs
@@ -1,4 +1,4 @@
use crate::ir::dispatch_table::{DispatchTableBuilder, DispatchTable};
use crate::ir::dispatch_table::{DispatchTable, DispatchTableBuilder};
use crate::ir::function;
use crate::IrDatabase;
use inkwell::{module::Module, values::FunctionValue};
Expand All @@ -18,7 +18,7 @@ pub struct ModuleIR {
pub functions: HashMap<mun_hir::Function, FunctionValue>,

/// The dispatch table
pub dispatch_table: DispatchTable
pub dispatch_table: DispatchTable,
}

/// Generates IR for the specified file
Expand Down Expand Up @@ -69,6 +69,6 @@ pub(crate) fn ir_query(db: &impl IrDatabase, file_id: FileId) -> Arc<ModuleIR> {
file_id,
llvm_module,
functions,
dispatch_table
dispatch_table,
})
}
18 changes: 9 additions & 9 deletions crates/mun_codegen/src/mock.rs
@@ -1,14 +1,14 @@
use mun_hir::{FileId, PackageInput,RelativePathBuf};
use std::sync::Arc;
use mun_hir::SourceDatabase;
use crate::{IrDatabase, OptimizationLevel};
use mun_hir::SourceDatabase;
use mun_hir::{FileId, PackageInput, RelativePathBuf};
use std::sync::Arc;

/// A mock implementation of the IR database. It can be used to set up a simple test case.
#[salsa::database(
mun_hir::SourceDatabaseStorage,
mun_hir::DefDatabaseStorage,
mun_hir::HirDatabaseStorage,
crate::IrDatabaseStorage
mun_hir::SourceDatabaseStorage,
mun_hir::DefDatabaseStorage,
mun_hir::HirDatabaseStorage,
crate::IrDatabaseStorage
)]
#[derive(Default, Debug)]
pub(crate) struct MockDatabase {
Expand All @@ -24,7 +24,7 @@ impl salsa::Database for MockDatabase {
impl MockDatabase {
/// Creates a database from the given text.
pub fn with_single_file(text: &str) -> (MockDatabase, FileId) {
let mut db:MockDatabase = Default::default();
let mut db: MockDatabase = Default::default();
let file_id = FileId(0);
db.set_file_relative_path(file_id, RelativePathBuf::from("main.mun"));
db.set_file_text(file_id, Arc::new(text.to_string()));
Expand All @@ -37,4 +37,4 @@ impl MockDatabase {
db.set_context(Arc::new(context));
(db, file_id)
}
}
}
4 changes: 2 additions & 2 deletions crates/mun_codegen/src/test.rs
@@ -1,9 +1,9 @@
use crate::{mock::MockDatabase, IrDatabase};
use mun_hir::diagnostics::DiagnosticSink;
use mun_hir::{Module};
use mun_hir::Module;
use std::cell::RefCell;
use std::path::PathBuf;
use test_utils::{dir_tests, project_dir};
use crate::{IrDatabase, mock::{MockDatabase}};

fn test_data_dir() -> PathBuf {
project_dir().join("crates/mun_codegen/tests/data/")
Expand Down
6 changes: 3 additions & 3 deletions crates/mun_compiler/src/lib.rs
Expand Up @@ -20,7 +20,7 @@ use mun_target::spec;
#[derive(Debug, Clone)]
pub enum PathOrInline {
Path(PathBuf),
Inline(String)
Inline(String),
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -117,11 +117,11 @@ impl CompilerDatabase {
PathOrInline::Path(p) => {
db.set_file_relative_path(file_id, RelativePathBuf::from_path(p).unwrap());
db.set_file_text(file_id, Arc::new(std::fs::read_to_string(p)?));
},
}
PathOrInline::Inline(text) => {
db.set_file_relative_path(file_id, RelativePathBuf::from_path("main.mun").unwrap());
db.set_file_text(file_id, Arc::new(text.clone()));
},
}
};

let mut package_input = PackageInput::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_compiler_daemon/src/lib.rs
Expand Up @@ -9,7 +9,7 @@ pub fn main(options: &CompilerOptions) -> Result<(), Error> {
// Need to canonicalize path to do comparisons
let input_path = match &options.input {
PathOrInline::Path(path) => path.canonicalize()?,
PathOrInline::Inline(_) => panic!("cannot run compiler with inline path")
PathOrInline::Inline(_) => panic!("cannot run compiler with inline path"),
};

// Compile at least once
Expand Down

0 comments on commit ed8552b

Please sign in to comment.