fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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