···1919 .file_for_index_canonical(origin_index)
2020 .expect("Macro 'Insert' was given a bad origin index")
2121 .clone();
2222- if args.len() != 1 {
2323- error_skid(
2424- context,
2525- origin_index,
2626- origin_line,
2727- format!(
2828- "Insert only accepts 1 argument, got given {} ({:?})",
2929- args.len(),
3030- args
3131- ),
3232- );
3333- }
34223523 let mut arg = args[0].clone();
3624 let mut search_from_root = arg.starts_with("//");
···6553 }
66546755 if !ok {
6868- error_skid(context, origin_index, origin_line, format!("Insert was unable to find the file \"{}\" relative to its origin or in project root.", arg));
5656+ error_skid(context, origin_index, origin_line, &format!("Insert was unable to find the file \"{}\" relative to its origin or in project root.", arg));
6957 }
70587159 let mut output = fs::read_to_string(&include_file).expect("File unreadable or missing");
···7777 context,
7878 origin_index,
7979 origin_line,
8080- format!(
8080+ &format!(
8181 "Macro `for_each_arg` given block with no \"[[{}..1]]\", intentional?",
8282 varname
8383 ),
···9999100100 if real_args.len() % replacement_count != 0 {
101101 error_skid(context, origin_index, origin_line,
102102- format!("`for_each_var` was not given a number of arguments({}) that was a multiple of its replacement posistions({}) (got {:?})",
102102+ &format!("`for_each_var` was not given a number of arguments({}) that was a multiple of its replacement posistions({}) (got {:?})",
103103 real_args.len(),
104104 replacement_count,
105105 real_args));
···5858 context,
5959 origin_index,
6060 origin_line,
6161- format!(
6161+ &format!(
6262 "Template \"{}\" requires exactly {} arguments, got given {} ({:?})",
6363 self.symbol,
6464 self.args.len(),
···7272 context,
7373 origin_index,
7474 origin_line,
7575- format!(
7575+ &format!(
7676 "Template \"{}\" requires at least {} arguments, got given {} ({:?})",
7777 self.symbol,
7878 self.args.len(),
···153153 context,
154154 origin_index,
155155 origin_line,
156156- format!("Attempted template redefinition of \"{}\"", args[0]),
156156+ &format!("Attempted template redefinition of \"{}\"", args[0]),
157157 );
158158 }
159159 }
···164164 context,
165165 origin_index,
166166 origin_line,
167167- format!(
167167+ &format!(
168168 "Attempted to make a template using a reserved name \"{}\"",
169169 args[0]
170170 ),
···178178 context,
179179 origin_index,
180180 origin_line,
181181- format!(
181181+ &format!(
182182 "Attempted to make a template using a reserved parameter name \"{}\"",
183183 arg
184184 ),
···196196 context,
197197 origin_index,
198198 origin_line,
199199- format!(
199199+ &format!(
200200 "Attempted to make a template with a parameter that contains whitespace \"{}\"",
201201 param
202202 ),
···209209 context,
210210 origin_index,
211211 origin_line,
212212- format!(
212212+ &format!(
213213 "Template definition of \"{}\" has {} paramters but only uses {}",
214214 args[0],
215215 args.len() - 1,
+10-16
src/main.rs
···3232 let ok = project_folder.pop();
3333 if !ok {
3434 error_generic(
3535- "No skidmark.toml project file found in this folder or ancestors.".into(),
3535+ &"No skidmark.toml project file found in this folder or ancestors.".into(),
3636 );
3737 }
3838 project_path = project_folder.clone();
···126126 context,
127127 file.tokens[file.working_index].template_origin,
128128 file.tokens[file.working_index].line_number,
129129- "Malformed Block".into(),
129129+ &"Malformed Block".into(),
130130 );
131131 }
132132 let block: Vec<Token>;
···197197 context,
198198 file.tokens[file.working_index].template_origin,
199199 file.tokens[file.working_index].line_number,
200200- "Malformed Block".into(),
200200+ &"Malformed Block".into(),
201201 );
202202 }
203203···251251 context,
252252 file.tokens[file.working_index].origin_file,
253253 file.tokens[file.working_index].line_number,
254254- format!(
254254+ &format!(
255255 "Token written as a function but no such function exists \"{}\"",
256256 file.tokens[file.working_index].contents.trim()
257257 ),
···296296 )
297297 .unwrap();
298298 fs::write(&file.file_out, &html_output).expect("Couldn't write output to file");
299299- ok_generic(format!(
300300- "\"{}\" written \n\n",
301301- file.file_out
302302- .to_str()
303303- .unwrap_or("Couldnt Unwrap file_out name")
304304- ));
305299 } else {
306300 fs::write(&file.file_out, &skid_output).expect("Couldn't write output to file");
307307- ok_generic(format!(
308308- "\"{}\" written \n\n",
309309- file.file_out
310310- .to_str()
311311- .unwrap_or("Couldnt Unwrap file_out name")
312312- ));
313301 }
302302+ ok_generic(&format!(
303303+ "\"{}\" written \n\n",
304304+ file.file_out
305305+ .to_str()
306306+ .unwrap_or("Couldnt Unwrap file_out name")
307307+ ));
314308}
+1-1
src/types.rs
···6666 scope: &[Token],
6767 ) -> Vec<Token> {
6868 if (args.len() > self.max_args) || (args.len() < self.min_args) {
6969- error_skid(context, origin_index, origin_line, format!("Macro \'{}\' was given a number of arguments ({}) not in its acceptable range ({}-{})",
6969+ error_skid(context, origin_index, origin_line, &format!("Macro \'{}\' was given a number of arguments ({}) not in its acceptable range ({}-{})",
7070 self.symbol, args.len(), self.min_args, if self.max_args == usize::max_value() {"No Limit".to_string()} else {format!("{}", self.max_args)}));
7171 Vec::new()
7272 } else {