diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2023-02-25 14:17:14 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2023-02-25 14:17:14 +0000 |
commit | 1455c3f85d8c57c6596fec0f7799e910fdf7af18 (patch) | |
tree | 8c89ce890fd3b8ca45437a0fe1af9fe40316b53d /src/doc.rs | |
parent | 1d7807cb85e56dd2c0ca2f91a36228cfc76b0797 (diff) | |
download | subplot-1455c3f85d8c57c6596fec0f7799e910fdf7af18.tar.gz |
(doc): Remove use of mut in Document method receivers where possible
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src/doc.rs')
-rw-r--r-- | src/doc.rs | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -155,7 +155,7 @@ impl Document { /// /// This is useful in a Pandoc filter, so that the filter can give /// it back to Pandoc for typesetting. - pub fn ast(&mut self) -> Result<String, SubplotError> { + pub fn ast(&self) -> Result<String, SubplotError> { self.md.to_json() } @@ -168,7 +168,7 @@ impl Document { /// /// The sources are any files that affect the output so that if /// the source file changes, the output needs to be re-generated. - pub fn sources(&mut self, template: Option<&str>) -> Vec<PathBuf> { + pub fn sources(&self, template: Option<&str>) -> Vec<PathBuf> { let mut names = vec![self.subplot.clone()]; for x in self.meta().bindings_filenames() { @@ -209,7 +209,7 @@ impl Document { } /// Check the document for common problems. - pub fn lint(&mut self) -> Result<(), SubplotError> { + pub fn lint(&self) -> Result<(), SubplotError> { trace!("Linting document"); self.check_doc_has_title()?; self.check_filenames_are_unique()?; @@ -240,7 +240,7 @@ impl Document { } /// Check that all the block classes in the document are known - fn check_block_classes(&mut self) -> Result<(), SubplotError> { + fn check_block_classes(&self) -> Result<(), SubplotError> { let classes_in_doc = self.md.block_classes(); // Build the set of known good classes @@ -367,15 +367,12 @@ impl Document { } /// Return all scenarios in a document. - pub fn scenarios(&mut self) -> Result<Vec<Scenario>, SubplotError> { + pub fn scenarios(&self) -> Result<Vec<Scenario>, SubplotError> { self.md.scenarios() } /// Return matched scenarios in a document. - pub fn matched_scenarios( - &mut self, - template: &str, - ) -> Result<Vec<MatchedScenario>, SubplotError> { + pub fn matched_scenarios(&self, template: &str) -> Result<Vec<MatchedScenario>, SubplotError> { let scenarios = self.scenarios()?; trace!( "Found {} scenarios, checking their bindings", |