@@ -788,7 +788,7 @@ impl<H> Easy2<H> {
788
788
/// /path/file.sock
789
789
/// ```
790
790
pub fn unix_socket ( & mut self , unix_domain_socket : & str ) -> Result < ( ) , Error > {
791
- let socket = try! ( CString :: new ( unix_domain_socket) ) ;
791
+ let socket = CString :: new ( unix_domain_socket) ? ;
792
792
self . setopt_str ( curl_sys:: CURLOPT_UNIX_SOCKET_PATH , & socket)
793
793
}
794
794
@@ -837,7 +837,7 @@ impl<H> Easy2<H> {
837
837
/// By default this option is not set and `perform` will not work until it
838
838
/// is set. This option corresponds to `CURLOPT_URL`.
839
839
pub fn url ( & mut self , url : & str ) -> Result < ( ) , Error > {
840
- let url = try! ( CString :: new ( url) ) ;
840
+ let url = CString :: new ( url) ? ;
841
841
self . setopt_str ( curl_sys:: CURLOPT_URL , & url)
842
842
}
843
843
@@ -858,7 +858,7 @@ impl<H> Easy2<H> {
858
858
///
859
859
/// By default this option is not set and corresponds to `CURLOPT_PROXY`.
860
860
pub fn proxy ( & mut self , url : & str ) -> Result < ( ) , Error > {
861
- let url = try! ( CString :: new ( url) ) ;
861
+ let url = CString :: new ( url) ? ;
862
862
self . setopt_str ( curl_sys:: CURLOPT_PROXY , & url)
863
863
}
864
864
@@ -887,7 +887,7 @@ impl<H> Easy2<H> {
887
887
/// By default this option is not set and corresponds to
888
888
/// `CURLOPT_NOPROXY`.
889
889
pub fn noproxy ( & mut self , skip : & str ) -> Result < ( ) , Error > {
890
- let skip = try! ( CString :: new ( skip) ) ;
890
+ let skip = CString :: new ( skip) ? ;
891
891
self . setopt_str ( curl_sys:: CURLOPT_NOPROXY , & skip)
892
892
}
893
893
@@ -909,7 +909,7 @@ impl<H> Easy2<H> {
909
909
/// By default this option is not set and corresponds to
910
910
/// `CURLOPT_INTERFACE`.
911
911
pub fn interface ( & mut self , interface : & str ) -> Result < ( ) , Error > {
912
- let s = try! ( CString :: new ( interface) ) ;
912
+ let s = CString :: new ( interface) ? ;
913
913
self . setopt_str ( curl_sys:: CURLOPT_INTERFACE , & s)
914
914
}
915
915
@@ -939,7 +939,7 @@ impl<H> Easy2<H> {
939
939
/// [c-ares](https://c-ares.haxx.se), otherwise setting it will return
940
940
/// an error.
941
941
pub fn dns_servers ( & mut self , servers : & str ) -> Result < ( ) , Error > {
942
- let s = try! ( CString :: new ( servers) ) ;
942
+ let s = CString :: new ( servers) ? ;
943
943
self . setopt_str ( curl_sys:: CURLOPT_DNS_SERVERS , & s)
944
944
}
945
945
@@ -1030,15 +1030,15 @@ impl<H> Easy2<H> {
1030
1030
///
1031
1031
/// By default this value is not set and corresponds to `CURLOPT_USERNAME`.
1032
1032
pub fn username ( & mut self , user : & str ) -> Result < ( ) , Error > {
1033
- let user = try! ( CString :: new ( user) ) ;
1033
+ let user = CString :: new ( user) ? ;
1034
1034
self . setopt_str ( curl_sys:: CURLOPT_USERNAME , & user)
1035
1035
}
1036
1036
1037
1037
/// Configures the password to pass as authentication for this connection.
1038
1038
///
1039
1039
/// By default this value is not set and corresponds to `CURLOPT_PASSWORD`.
1040
1040
pub fn password ( & mut self , pass : & str ) -> Result < ( ) , Error > {
1041
- let pass = try! ( CString :: new ( pass) ) ;
1041
+ let pass = CString :: new ( pass) ? ;
1042
1042
self . setopt_str ( curl_sys:: CURLOPT_PASSWORD , & pass)
1043
1043
}
1044
1044
@@ -1063,7 +1063,7 @@ impl<H> Easy2<H> {
1063
1063
/// By default this value is not set and corresponds to
1064
1064
/// `CURLOPT_PROXYUSERNAME`.
1065
1065
pub fn proxy_username ( & mut self , user : & str ) -> Result < ( ) , Error > {
1066
- let user = try! ( CString :: new ( user) ) ;
1066
+ let user = CString :: new ( user) ? ;
1067
1067
self . setopt_str ( curl_sys:: CURLOPT_PROXYUSERNAME , & user)
1068
1068
}
1069
1069
@@ -1073,7 +1073,7 @@ impl<H> Easy2<H> {
1073
1073
/// By default this value is not set and corresponds to
1074
1074
/// `CURLOPT_PROXYPASSWORD`.
1075
1075
pub fn proxy_password ( & mut self , pass : & str ) -> Result < ( ) , Error > {
1076
- let pass = try! ( CString :: new ( pass) ) ;
1076
+ let pass = CString :: new ( pass) ? ;
1077
1077
self . setopt_str ( curl_sys:: CURLOPT_PROXYPASSWORD , & pass)
1078
1078
}
1079
1079
@@ -1119,7 +1119,7 @@ impl<H> Easy2<H> {
1119
1119
/// By default this option is not set and corresponds to
1120
1120
/// `CURLOPT_ACCEPT_ENCODING`.
1121
1121
pub fn accept_encoding ( & mut self , encoding : & str ) -> Result < ( ) , Error > {
1122
- let encoding = try! ( CString :: new ( encoding) ) ;
1122
+ let encoding = CString :: new ( encoding) ? ;
1123
1123
self . setopt_str ( curl_sys:: CURLOPT_ACCEPT_ENCODING , & encoding)
1124
1124
}
1125
1125
@@ -1194,7 +1194,7 @@ impl<H> Easy2<H> {
1194
1194
/// `CURLOPT_COPYPOSTFIELDS`.
1195
1195
pub fn post_fields_copy ( & mut self , data : & [ u8 ] ) -> Result < ( ) , Error > {
1196
1196
// Set the length before the pointer so libcurl knows how much to read
1197
- try! ( self . post_field_size ( data. len ( ) as u64 ) ) ;
1197
+ self . post_field_size ( data. len ( ) as u64 ) ? ;
1198
1198
self . setopt_ptr ( curl_sys:: CURLOPT_COPYPOSTFIELDS , data. as_ptr ( ) as * const _ )
1199
1199
}
1200
1200
@@ -1209,7 +1209,7 @@ impl<H> Easy2<H> {
1209
1209
/// `CURLOPT_POSTFIELDSIZE_LARGE`.
1210
1210
pub fn post_field_size ( & mut self , size : u64 ) -> Result < ( ) , Error > {
1211
1211
// Clear anything previous to ensure we don't read past a buffer
1212
- try! ( self . setopt_ptr ( curl_sys:: CURLOPT_POSTFIELDS , 0 as * const _ ) ) ;
1212
+ self . setopt_ptr ( curl_sys:: CURLOPT_POSTFIELDS , 0 as * const _ ) ? ;
1213
1213
self . setopt_off_t (
1214
1214
curl_sys:: CURLOPT_POSTFIELDSIZE_LARGE ,
1215
1215
size as curl_sys:: curl_off_t ,
@@ -1222,7 +1222,7 @@ impl<H> Easy2<H> {
1222
1222
/// By default this option is set to null and corresponds to
1223
1223
/// `CURLOPT_HTTPPOST`.
1224
1224
pub fn httppost ( & mut self , form : Form ) -> Result < ( ) , Error > {
1225
- try! ( self . setopt_ptr ( curl_sys:: CURLOPT_HTTPPOST , form:: raw ( & form) as * const _ ) ) ;
1225
+ self . setopt_ptr ( curl_sys:: CURLOPT_HTTPPOST , form:: raw ( & form) as * const _ ) ? ;
1226
1226
self . inner . form = Some ( form) ;
1227
1227
Ok ( ( ) )
1228
1228
}
@@ -1231,7 +1231,7 @@ impl<H> Easy2<H> {
1231
1231
///
1232
1232
/// By default this option is not set and corresponds to `CURLOPT_REFERER`.
1233
1233
pub fn referer ( & mut self , referer : & str ) -> Result < ( ) , Error > {
1234
- let referer = try! ( CString :: new ( referer) ) ;
1234
+ let referer = CString :: new ( referer) ? ;
1235
1235
self . setopt_str ( curl_sys:: CURLOPT_REFERER , & referer)
1236
1236
}
1237
1237
@@ -1240,7 +1240,7 @@ impl<H> Easy2<H> {
1240
1240
/// By default this option is not set and corresponds to
1241
1241
/// `CURLOPT_USERAGENT`.
1242
1242
pub fn useragent ( & mut self , useragent : & str ) -> Result < ( ) , Error > {
1243
- let useragent = try! ( CString :: new ( useragent) ) ;
1243
+ let useragent = CString :: new ( useragent) ? ;
1244
1244
self . setopt_str ( curl_sys:: CURLOPT_USERAGENT , & useragent)
1245
1245
}
1246
1246
@@ -1298,7 +1298,7 @@ impl<H> Easy2<H> {
1298
1298
///
1299
1299
/// By default this option is not set and corresponds to `CURLOPT_COOKIE`.
1300
1300
pub fn cookie ( & mut self , cookie : & str ) -> Result < ( ) , Error > {
1301
- let cookie = try! ( CString :: new ( cookie) ) ;
1301
+ let cookie = CString :: new ( cookie) ? ;
1302
1302
self . setopt_str ( curl_sys:: CURLOPT_COOKIE , & cookie)
1303
1303
}
1304
1304
@@ -1382,7 +1382,7 @@ impl<H> Easy2<H> {
1382
1382
///
1383
1383
/// By default this options corresponds to `CURLOPT_COOKIELIST`
1384
1384
pub fn cookie_list ( & mut self , cookie : & str ) -> Result < ( ) , Error > {
1385
- let cookie = try! ( CString :: new ( cookie) ) ;
1385
+ let cookie = CString :: new ( cookie) ? ;
1386
1386
self . setopt_str ( curl_sys:: CURLOPT_COOKIELIST , & cookie)
1387
1387
}
1388
1388
@@ -1471,7 +1471,7 @@ impl<H> Easy2<H> {
1471
1471
///
1472
1472
/// By default this option is not set and corresponds to `CURLOPT_RANGE`.
1473
1473
pub fn range ( & mut self , range : & str ) -> Result < ( ) , Error > {
1474
- let range = try! ( CString :: new ( range) ) ;
1474
+ let range = CString :: new ( range) ? ;
1475
1475
self . setopt_str ( curl_sys:: CURLOPT_RANGE , & range)
1476
1476
}
1477
1477
@@ -1497,7 +1497,7 @@ impl<H> Easy2<H> {
1497
1497
/// By default this option is not set and corresponds to
1498
1498
/// `CURLOPT_CUSTOMREQUEST`.
1499
1499
pub fn custom_request ( & mut self , request : & str ) -> Result < ( ) , Error > {
1500
- let request = try! ( CString :: new ( request) ) ;
1500
+ let request = CString :: new ( request) ? ;
1501
1501
self . setopt_str ( curl_sys:: CURLOPT_CUSTOMREQUEST , & request)
1502
1502
}
1503
1503
@@ -1776,7 +1776,7 @@ impl<H> Easy2<H> {
1776
1776
// /// By default this option is not set and corresponds to
1777
1777
// /// `CURLOPT_DNS_INTERFACE`.
1778
1778
// pub fn dns_interface(&mut self, interface: &str) -> Result<(), Error> {
1779
- // let interface = try!( CString::new(interface)) ;
1779
+ // let interface = CString::new(interface)? ;
1780
1780
// self.setopt_str(curl_sys::CURLOPT_DNS_INTERFACE, &interface)
1781
1781
// }
1782
1782
//
@@ -1789,7 +1789,7 @@ impl<H> Easy2<H> {
1789
1789
// /// By default this option is not set and corresponds to
1790
1790
// /// `CURLOPT_DNS_LOCAL_IP4`.
1791
1791
// pub fn dns_local_ip4(&mut self, ip: &str) -> Result<(), Error> {
1792
- // let ip = try!( CString::new(ip)) ;
1792
+ // let ip = CString::new(ip)? ;
1793
1793
// self.setopt_str(curl_sys::CURLOPT_DNS_LOCAL_IP4, &ip)
1794
1794
// }
1795
1795
//
@@ -1802,7 +1802,7 @@ impl<H> Easy2<H> {
1802
1802
// /// By default this option is not set and corresponds to
1803
1803
// /// `CURLOPT_DNS_LOCAL_IP6`.
1804
1804
// pub fn dns_local_ip6(&mut self, ip: &str) -> Result<(), Error> {
1805
- // let ip = try!( CString::new(ip)) ;
1805
+ // let ip = CString::new(ip)? ;
1806
1806
// self.setopt_str(curl_sys::CURLOPT_DNS_LOCAL_IP6, &ip)
1807
1807
// }
1808
1808
//
@@ -1818,7 +1818,7 @@ impl<H> Easy2<H> {
1818
1818
// /// By default this option is not set and corresponds to
1819
1819
// /// `CURLOPT_DNS_SERVERS`.
1820
1820
// pub fn dns_servers(&mut self, servers: &str) -> Result<(), Error> {
1821
- // let servers = try!( CString::new(servers)) ;
1821
+ // let servers = CString::new(servers)? ;
1822
1822
// self.setopt_str(curl_sys::CURLOPT_DNS_SERVERS, &servers)
1823
1823
// }
1824
1824
@@ -1855,7 +1855,7 @@ impl<H> Easy2<H> {
1855
1855
/// By default this option is "PEM" and corresponds to
1856
1856
/// `CURLOPT_SSLCERTTYPE`.
1857
1857
pub fn ssl_cert_type ( & mut self , kind : & str ) -> Result < ( ) , Error > {
1858
- let kind = try! ( CString :: new ( kind) ) ;
1858
+ let kind = CString :: new ( kind) ? ;
1859
1859
self . setopt_str ( curl_sys:: CURLOPT_SSLCERTTYPE , & kind)
1860
1860
}
1861
1861
@@ -1887,7 +1887,7 @@ impl<H> Easy2<H> {
1887
1887
/// By default this option is "PEM" and corresponds to
1888
1888
/// `CURLOPT_SSLKEYTYPE`.
1889
1889
pub fn ssl_key_type ( & mut self , kind : & str ) -> Result < ( ) , Error > {
1890
- let kind = try! ( CString :: new ( kind) ) ;
1890
+ let kind = CString :: new ( kind) ? ;
1891
1891
self . setopt_str ( curl_sys:: CURLOPT_SSLKEYTYPE , & kind)
1892
1892
}
1893
1893
@@ -1900,7 +1900,7 @@ impl<H> Easy2<H> {
1900
1900
/// By default this option is not set and corresponds to
1901
1901
/// `CURLOPT_KEYPASSWD`.
1902
1902
pub fn key_password ( & mut self , password : & str ) -> Result < ( ) , Error > {
1903
- let password = try! ( CString :: new ( password) ) ;
1903
+ let password = CString :: new ( password) ? ;
1904
1904
self . setopt_str ( curl_sys:: CURLOPT_KEYPASSWD , & password)
1905
1905
}
1906
1906
@@ -1912,7 +1912,7 @@ impl<H> Easy2<H> {
1912
1912
/// By default this option is not set and corresponds to
1913
1913
/// `CURLOPT_SSLENGINE`.
1914
1914
pub fn ssl_engine ( & mut self , engine : & str ) -> Result < ( ) , Error > {
1915
- let engine = try! ( CString :: new ( engine) ) ;
1915
+ let engine = CString :: new ( engine) ? ;
1916
1916
self . setopt_str ( curl_sys:: CURLOPT_SSLENGINE , & engine)
1917
1917
}
1918
1918
@@ -2140,7 +2140,7 @@ impl<H> Easy2<H> {
2140
2140
/// By default this option is not set and corresponds to
2141
2141
/// `CURLOPT_SSL_CIPHER_LIST`.
2142
2142
pub fn ssl_cipher_list ( & mut self , ciphers : & str ) -> Result < ( ) , Error > {
2143
- let ciphers = try! ( CString :: new ( ciphers) ) ;
2143
+ let ciphers = CString :: new ( ciphers) ? ;
2144
2144
self . setopt_str ( curl_sys:: CURLOPT_SSL_CIPHER_LIST , & ciphers)
2145
2145
}
2146
2146
@@ -2553,7 +2553,7 @@ impl<H> Easy2<H> {
2553
2553
curl_sys:: CURLINFO_COOKIELIST ,
2554
2554
& mut list,
2555
2555
) ;
2556
- try! ( self . cvt ( rc) ) ;
2556
+ self . cvt ( rc) ? ;
2557
2557
Ok ( list:: from_raw ( list) )
2558
2558
}
2559
2559
}
@@ -2770,7 +2770,7 @@ impl<H> Easy2<H> {
2770
2770
data. len ( ) ,
2771
2771
& mut n,
2772
2772
) ;
2773
- try! ( self . cvt ( rc) ) ;
2773
+ self . cvt ( rc) ? ;
2774
2774
Ok ( n)
2775
2775
}
2776
2776
}
@@ -2783,14 +2783,14 @@ impl<H> Easy2<H> {
2783
2783
#[ cfg( unix) ]
2784
2784
fn setopt_path ( & mut self , opt : curl_sys:: CURLoption , val : & Path ) -> Result < ( ) , Error > {
2785
2785
use std:: os:: unix:: prelude:: * ;
2786
- let s = try! ( CString :: new ( val. as_os_str ( ) . as_bytes ( ) ) ) ;
2786
+ let s = CString :: new ( val. as_os_str ( ) . as_bytes ( ) ) ? ;
2787
2787
self . setopt_str ( opt, & s)
2788
2788
}
2789
2789
2790
2790
#[ cfg( windows) ]
2791
2791
fn setopt_path ( & mut self , opt : curl_sys:: CURLoption , val : & Path ) -> Result < ( ) , Error > {
2792
2792
match val. to_str ( ) {
2793
- Some ( s) => self . setopt_str ( opt, & try! ( CString :: new ( s) ) ) ,
2793
+ Some ( s) => self . setopt_str ( opt, & CString :: new ( s) ? ) ,
2794
2794
None => Err ( Error :: new ( curl_sys:: CURLE_CONV_FAILED ) ) ,
2795
2795
}
2796
2796
}
@@ -2820,7 +2820,7 @@ impl<H> Easy2<H> {
2820
2820
2821
2821
fn getopt_bytes ( & mut self , opt : curl_sys:: CURLINFO ) -> Result < Option < & [ u8 ] > , Error > {
2822
2822
unsafe {
2823
- let p = try! ( self . getopt_ptr ( opt) ) ;
2823
+ let p = self . getopt_ptr ( opt) ? ;
2824
2824
if p. is_null ( ) {
2825
2825
Ok ( None )
2826
2826
} else {
@@ -2833,7 +2833,7 @@ impl<H> Easy2<H> {
2833
2833
unsafe {
2834
2834
let mut p = 0 as * const c_char ;
2835
2835
let rc = curl_sys:: curl_easy_getinfo ( self . inner . handle , opt, & mut p) ;
2836
- try! ( self . cvt ( rc) ) ;
2836
+ self . cvt ( rc) ? ;
2837
2837
Ok ( p)
2838
2838
}
2839
2839
}
@@ -2853,7 +2853,7 @@ impl<H> Easy2<H> {
2853
2853
unsafe {
2854
2854
let mut p = 0 ;
2855
2855
let rc = curl_sys:: curl_easy_getinfo ( self . inner . handle , opt, & mut p) ;
2856
- try! ( self . cvt ( rc) ) ;
2856
+ self . cvt ( rc) ? ;
2857
2857
Ok ( p)
2858
2858
}
2859
2859
}
@@ -2862,7 +2862,7 @@ impl<H> Easy2<H> {
2862
2862
unsafe {
2863
2863
let mut p = 0 as c_double ;
2864
2864
let rc = curl_sys:: curl_easy_getinfo ( self . inner . handle , opt, & mut p) ;
2865
- try! ( self . cvt ( rc) ) ;
2865
+ self . cvt ( rc) ? ;
2866
2866
Ok ( p)
2867
2867
}
2868
2868
}
0 commit comments