From 9053dded12fe83b08486a408122d1e4aa04bf8dc Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Tue, 29 Dec 2020 23:59:35 +0100 Subject: [PATCH] bump: rust 1.48 --- crates/mun_codegen/src/mock.rs | 4 ++-- crates/mun_compiler/src/diagnostics_snippets.rs | 2 +- crates/mun_compiler/src/driver.rs | 12 ++++++------ crates/mun_hir/src/db.rs | 2 +- crates/mun_hir/src/fixture.rs | 2 +- crates/mun_hir/src/tests.rs | 2 +- crates/mun_language_server/src/change.rs | 10 +++++----- crates/mun_language_server/src/main_loop.rs | 6 +++--- crates/mun_syntax/src/lib.rs | 8 ++++---- crates/mun_test/src/fixture.rs | 2 +- rust-toolchain | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/crates/mun_codegen/src/mock.rs b/crates/mun_codegen/src/mock.rs index feb680485..33d1b90f2 100644 --- a/crates/mun_codegen/src/mock.rs +++ b/crates/mun_codegen/src/mock.rs @@ -80,11 +80,11 @@ impl MockDatabase { let mut source_root = SourceRoot::default(); let source_root_id = SourceRootId(0); - let text = Arc::new(text.to_owned()); + let text = Arc::from(text.to_owned()); let rel_path = RelativePathBuf::from("main.mun"); let file_id = FileId(0); db.set_file_relative_path(file_id, rel_path.clone()); - db.set_file_text(file_id, Arc::new(text.to_string())); + db.set_file_text(file_id, text); db.set_file_source_root(file_id, source_root_id); source_root.insert_file(file_id); diff --git a/crates/mun_compiler/src/diagnostics_snippets.rs b/crates/mun_compiler/src/diagnostics_snippets.rs index 853d925be..1491886b7 100644 --- a/crates/mun_compiler/src/diagnostics_snippets.rs +++ b/crates/mun_compiler/src/diagnostics_snippets.rs @@ -84,7 +84,7 @@ fn emit_diagnostic( /// Will hold all snippets and their relevant information struct AnnotationFile { relative_file_path: RelativePathBuf, - source_code: Arc, + source_code: Arc, line_index: Arc, annotations: Vec, }; diff --git a/crates/mun_compiler/src/driver.rs b/crates/mun_compiler/src/driver.rs index a0eb56602..813004a3e 100644 --- a/crates/mun_compiler/src/driver.rs +++ b/crates/mun_compiler/src/driver.rs @@ -90,7 +90,7 @@ impl Driver { let file_id = FileId(driver.next_file_id as u32); driver.next_file_id += 1; driver.db.set_file_relative_path(file_id, rel_path); - driver.db.set_file_text(file_id, Arc::new(text)); + driver.db.set_file_text(file_id, Arc::from(text)); driver.db.set_file_source_root(file_id, WORKSPACE); driver.source_root.insert_file(file_id); driver @@ -138,7 +138,7 @@ impl Driver { driver .db .set_file_relative_path(file_id, relative_path.clone()); - driver.db.set_file_text(file_id, Arc::new(file_contents)); + driver.db.set_file_text(file_id, Arc::from(file_contents)); driver.db.set_file_source_root(file_id, WORKSPACE); driver.source_root.insert_file(file_id); } @@ -191,7 +191,7 @@ impl Driver { /// Sets the contents of a specific file. pub fn set_file_text>(&mut self, file_id: FileId, text: T) { self.db - .set_file_text(file_id, Arc::new(text.as_ref().to_owned())); + .set_file_text(file_id, Arc::from(text.as_ref().to_owned())); } } @@ -215,7 +215,7 @@ impl Driver { emit_syntax_error( syntax_error, relative_file_path.as_str(), - source_code.as_str(), + &source_code, &line_index, emit_colors, writer, @@ -326,7 +326,7 @@ impl Driver { .path_to_file_id .get(path.as_ref()) .expect("writing to a file that is not part of the source root should never happen"); - self.db.set_file_text(file_id, Arc::new(contents)); + self.db.set_file_text(file_id, Arc::from(contents)); file_id } @@ -337,7 +337,7 @@ impl Driver { // Insert the new file self.db .set_file_relative_path(file_id, path.as_ref().to_relative_path_buf()); - self.db.set_file_text(file_id, Arc::new(contents)); + self.db.set_file_text(file_id, Arc::from(contents)); self.db.set_file_source_root(file_id, WORKSPACE); // Update the source root diff --git a/crates/mun_hir/src/db.rs b/crates/mun_hir/src/db.rs index 81b4998cd..c80c8eeaa 100644 --- a/crates/mun_hir/src/db.rs +++ b/crates/mun_hir/src/db.rs @@ -32,7 +32,7 @@ pub trait Upcast { pub trait SourceDatabase: salsa::Database { /// Text of the file. #[salsa::input] - fn file_text(&self, file_id: FileId) -> Arc; + fn file_text(&self, file_id: FileId) -> Arc; /// Path to a file, relative to the root of its source root. #[salsa::input] diff --git a/crates/mun_hir/src/fixture.rs b/crates/mun_hir/src/fixture.rs index 3af7efca2..2d4f3f269 100644 --- a/crates/mun_hir/src/fixture.rs +++ b/crates/mun_hir/src/fixture.rs @@ -38,7 +38,7 @@ fn with_files(db: &mut dyn SourceDatabase, fixture: &str) -> Vec { for (idx, entry) in fixture.into_iter().enumerate() { let file_id = FileId(idx.try_into().expect("too many files")); db.set_file_relative_path(file_id, entry.relative_path); - db.set_file_text(file_id, Arc::new(entry.text)); + db.set_file_text(file_id, Arc::from(entry.text)); db.set_file_source_root(file_id, source_root_id); source_root.insert_file(file_id); files.push(file_id); diff --git a/crates/mun_hir/src/tests.rs b/crates/mun_hir/src/tests.rs index 6260c9c09..edd86d14b 100644 --- a/crates/mun_hir/src/tests.rs +++ b/crates/mun_hir/src/tests.rs @@ -30,7 +30,7 @@ fn check_package_defs_does_not_change() { } db.set_file_text( file_id, - Arc::new( + Arc::from( r#" fn foo()->i32 { 90 diff --git a/crates/mun_language_server/src/change.rs b/crates/mun_language_server/src/change.rs index e9af08788..b2826c19d 100644 --- a/crates/mun_language_server/src/change.rs +++ b/crates/mun_language_server/src/change.rs @@ -9,7 +9,7 @@ use std::sync::Arc; pub struct AnalysisChange { new_roots: Vec<(hir::SourceRootId, hir::PackageId)>, roots_changed: HashMap, - files_changed: Vec<(hir::FileId, Arc)>, + files_changed: Vec<(hir::FileId, Arc)>, } impl fmt::Debug for AnalysisChange { @@ -45,7 +45,7 @@ impl AnalysisChange { root_id: hir::SourceRootId, file_id: hir::FileId, path: hir::RelativePathBuf, - text: Arc, + text: Arc, ) { let file = AddFile { file_id, @@ -60,7 +60,7 @@ impl AnalysisChange { } /// Records the change of content of a specific file - pub fn change_file(&mut self, file_id: hir::FileId, new_text: Arc) { + pub fn change_file(&mut self, file_id: hir::FileId, new_text: Arc) { self.files_changed.push((file_id, new_text)) } @@ -85,7 +85,7 @@ impl AnalysisChange { struct AddFile { file_id: hir::FileId, path: hir::RelativePathBuf, - text: Arc, + text: Arc, } /// Represents the removal of a file from a source root. @@ -130,7 +130,7 @@ impl AnalysisDatabase { source_root.insert_file(add_file.file_id) } for remove_file in root_change.removed { - self.set_file_text(remove_file.file_id, Default::default()); + self.set_file_text(remove_file.file_id, Arc::from("")); source_root.remove_file(remove_file.file_id); } self.set_source_root(root_id, Arc::new(source_root)); diff --git a/crates/mun_language_server/src/main_loop.rs b/crates/mun_language_server/src/main_loop.rs index 0f8ecf9fd..a95cc4206 100644 --- a/crates/mun_language_server/src/main_loop.rs +++ b/crates/mun_language_server/src/main_loop.rs @@ -547,7 +547,7 @@ impl LanguageServerState { hir::SourceRootId(root.0), hir::FileId(file.0), path, - text, + Arc::from(text.to_string()), ); } } @@ -561,7 +561,7 @@ impl LanguageServerState { hir::SourceRootId(root.0), hir::FileId(file.0), path, - text, + Arc::from(text.to_string()), ); } VfsChange::RemoveFile { root, file, path } => analysis_change.remove_file( @@ -570,7 +570,7 @@ impl LanguageServerState { path, ), VfsChange::ChangeFile { file, text } => { - analysis_change.change_file(hir::FileId(file.0), text); + analysis_change.change_file(hir::FileId(file.0), Arc::from(text.to_string())); } } } diff --git a/crates/mun_syntax/src/lib.rs b/crates/mun_syntax/src/lib.rs index 2db682283..15224f9f8 100644 --- a/crates/mun_syntax/src/lib.rs +++ b/crates/mun_syntax/src/lib.rs @@ -41,7 +41,7 @@ use rowan::GreenNode; #[derive(Debug, PartialEq, Eq)] pub struct Parse { green: GreenNode, - errors: Arc>, + errors: Arc<[SyntaxError]>, _ty: PhantomData T>, } @@ -59,7 +59,7 @@ impl Parse { fn new(green: GreenNode, errors: Vec) -> Parse { Parse { green, - errors: Arc::new(errors), + errors: Arc::from(errors), _ty: PhantomData, } } @@ -86,7 +86,7 @@ impl Parse { &*self.errors } - pub fn ok(self) -> Result>> { + pub fn ok(self) -> Result> { if self.errors.is_empty() { Ok(self.tree()) } else { @@ -128,7 +128,7 @@ impl SourceFile { //errors.extend(validation::validate(&SourceFile::new(green.clone()))); Parse { green, - errors: Arc::new(errors), + errors: Arc::from(errors), _ty: PhantomData, } } diff --git a/crates/mun_test/src/fixture.rs b/crates/mun_test/src/fixture.rs index 040c646a7..986331d31 100644 --- a/crates/mun_test/src/fixture.rs +++ b/crates/mun_test/src/fixture.rs @@ -63,7 +63,7 @@ impl Fixture { result.push(meta); } else if let Some(entry) = result.last_mut() { entry.text.push_str(line); - entry.text.push_str("\n"); + entry.text.push('\n'); } } diff --git a/rust-toolchain b/rust-toolchain index 21998d3c2..9db5ea12f 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.47.0 +1.48.0