@@ -50,6 +50,7 @@ pub struct Session {
50
50
}
51
51
52
52
fn smart_split ( text : & str ) -> Vec < String > {
53
+ let c = text. split ( " " ) ;
53
54
let mut r = vec ! [ ] ;
54
55
let mut s = "" . to_string ( ) ;
55
56
let mut d = 0 ;
@@ -256,25 +257,31 @@ impl Frame {
256
257
Ok ( ( ) )
257
258
}
258
259
259
- pub fn deny_dependency ( & self , name : String ) -> tactic:: Result < ( ) > {
260
+ pub fn deny_dependency ( & self , name : & str ) -> tactic:: Result < ( ) > {
260
261
for ( _, hyp) in & self . hyps {
261
262
if predict_axiom ( hyp, & |x| x == name) {
262
- return Err ( tactic:: Error :: ContextDependOnHyp ( name, hyp. clone ( ) ) ) ;
263
+ return Err ( tactic:: Error :: ContextDependOnHyp (
264
+ name. to_string ( ) ,
265
+ hyp. clone ( ) ,
266
+ ) ) ;
263
267
}
264
268
}
265
269
if predict_axiom ( & self . goal , & |x| x == name) {
266
- return Err ( tactic:: Error :: ContextDependOnHyp ( name, self . goal . clone ( ) ) ) ;
270
+ return Err ( tactic:: Error :: ContextDependOnHyp (
271
+ name. to_string ( ) ,
272
+ self . goal . clone ( ) ,
273
+ ) ) ;
267
274
}
268
275
Ok ( ( ) )
269
276
}
270
277
271
- pub fn remove_hyp_with_name ( & mut self , name : String ) -> tactic:: Result < TermRef > {
272
- self . deny_dependency ( name. clone ( ) ) ?;
273
- if let Some ( hyp) = self . hyps . remove ( & name) {
274
- self . engine . remove_name_unchecked ( & name) ;
278
+ pub fn remove_hyp_with_name ( & mut self , name : & str ) -> tactic:: Result < TermRef > {
279
+ self . deny_dependency ( name) ?;
280
+ if let Some ( hyp) = self . hyps . remove ( name) {
281
+ self . engine . remove_name_unchecked ( name) ;
275
282
return Ok ( hyp) ;
276
283
}
277
- Err ( tactic:: Error :: UnknownHyp ( name) )
284
+ Err ( tactic:: Error :: UnknownHyp ( name. to_string ( ) ) )
278
285
}
279
286
280
287
pub fn suggest_on_goal_dblclk ( & self ) -> Option < Suggestion > {
@@ -295,10 +302,10 @@ impl Frame {
295
302
296
303
pub fn run_tactic ( & self , line : & str ) -> Result < Vec < Self > , tactic:: Error > {
297
304
let parts = smart_split ( line) ;
298
- let mut parts = parts. into_iter ( ) ;
305
+ let mut parts = parts. iter ( ) . map ( |x| x . as_str ( ) ) ;
299
306
let name = parts. next ( ) . ok_or ( tactic:: Error :: EmptyTactic ) ?;
300
307
let frame = self . clone ( ) ;
301
- match name. as_str ( ) {
308
+ match name {
302
309
"intros" => intros ( frame, parts) ,
303
310
"rewrite" => rewrite ( frame, parts) ,
304
311
"replace" => replace ( frame, parts) ,
0 commit comments