• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1error: stripping a prefix manually
2  --> $DIR/manual_strip.rs:7:24
3   |
4LL |         str::to_string(&s["ab".len()..]);
5   |                        ^^^^^^^^^^^^^^^^
6   |
7note: the prefix was tested here
8  --> $DIR/manual_strip.rs:6:5
9   |
10LL |     if s.starts_with("ab") {
11   |     ^^^^^^^^^^^^^^^^^^^^^^^
12   = note: `-D clippy::manual-strip` implied by `-D warnings`
13help: try using the `strip_prefix` method
14   |
15LL ~     if let Some(<stripped>) = s.strip_prefix("ab") {
16LL ~         str::to_string(<stripped>);
17LL ~         <stripped>.to_string();
18LL |
19LL ~         str::to_string(<stripped>);
20LL ~         <stripped>.to_string();
21   |
22
23error: stripping a suffix manually
24  --> $DIR/manual_strip.rs:15:24
25   |
26LL |         str::to_string(&s[..s.len() - "bc".len()]);
27   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
28   |
29note: the suffix was tested here
30  --> $DIR/manual_strip.rs:14:5
31   |
32LL |     if s.ends_with("bc") {
33   |     ^^^^^^^^^^^^^^^^^^^^^
34help: try using the `strip_suffix` method
35   |
36LL ~     if let Some(<stripped>) = s.strip_suffix("bc") {
37LL ~         str::to_string(<stripped>);
38LL ~         <stripped>.to_string();
39LL |
40LL ~         str::to_string(<stripped>);
41LL ~         <stripped>.to_string();
42   |
43
44error: stripping a prefix manually
45  --> $DIR/manual_strip.rs:24:24
46   |
47LL |         str::to_string(&s[1..]);
48   |                        ^^^^^^^
49   |
50note: the prefix was tested here
51  --> $DIR/manual_strip.rs:23:5
52   |
53LL |     if s.starts_with('a') {
54   |     ^^^^^^^^^^^^^^^^^^^^^^
55help: try using the `strip_prefix` method
56   |
57LL ~     if let Some(<stripped>) = s.strip_prefix('a') {
58LL ~         str::to_string(<stripped>);
59LL ~         <stripped>.to_string();
60   |
61
62error: stripping a prefix manually
63  --> $DIR/manual_strip.rs:31:24
64   |
65LL |         str::to_string(&s[prefix.len()..]);
66   |                        ^^^^^^^^^^^^^^^^^^
67   |
68note: the prefix was tested here
69  --> $DIR/manual_strip.rs:30:5
70   |
71LL |     if s.starts_with(prefix) {
72   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
73help: try using the `strip_prefix` method
74   |
75LL ~     if let Some(<stripped>) = s.strip_prefix(prefix) {
76LL ~         str::to_string(<stripped>);
77   |
78
79error: stripping a prefix manually
80  --> $DIR/manual_strip.rs:37:24
81   |
82LL |         str::to_string(&s[PREFIX.len()..]);
83   |                        ^^^^^^^^^^^^^^^^^^
84   |
85note: the prefix was tested here
86  --> $DIR/manual_strip.rs:36:5
87   |
88LL |     if s.starts_with(PREFIX) {
89   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
90help: try using the `strip_prefix` method
91   |
92LL ~     if let Some(<stripped>) = s.strip_prefix(PREFIX) {
93LL ~         str::to_string(<stripped>);
94LL ~         str::to_string(<stripped>);
95   |
96
97error: stripping a prefix manually
98  --> $DIR/manual_strip.rs:44:24
99   |
100LL |         str::to_string(&TARGET[prefix.len()..]);
101   |                        ^^^^^^^^^^^^^^^^^^^^^^^
102   |
103note: the prefix was tested here
104  --> $DIR/manual_strip.rs:43:5
105   |
106LL |     if TARGET.starts_with(prefix) {
107   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
108help: try using the `strip_prefix` method
109   |
110LL ~     if let Some(<stripped>) = TARGET.strip_prefix(prefix) {
111LL ~         str::to_string(<stripped>);
112   |
113
114error: stripping a prefix manually
115  --> $DIR/manual_strip.rs:50:9
116   |
117LL |         s1[2..].to_uppercase();
118   |         ^^^^^^^
119   |
120note: the prefix was tested here
121  --> $DIR/manual_strip.rs:49:5
122   |
123LL |     if s1.starts_with("ab") {
124   |     ^^^^^^^^^^^^^^^^^^^^^^^^
125help: try using the `strip_prefix` method
126   |
127LL ~     if let Some(<stripped>) = s1.strip_prefix("ab") {
128LL ~         <stripped>.to_uppercase();
129   |
130
131error: stripping a prefix manually
132  --> $DIR/manual_strip.rs:80:9
133   |
134LL |         s[1..].to_string();
135   |         ^^^^^^
136   |
137note: the prefix was tested here
138  --> $DIR/manual_strip.rs:79:5
139   |
140LL |     if s.starts_with('a') {
141   |     ^^^^^^^^^^^^^^^^^^^^^^
142help: try using the `strip_prefix` method
143   |
144LL ~     if let Some(<stripped>) = s.strip_prefix('a') {
145LL ~         <stripped>.to_string();
146   |
147
148error: aborting due to 8 previous errors
149
150